Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ucontext_t is missing on aarch64-unknown-freebsd #3217

Closed
jbeich opened this issue Apr 23, 2023 · 3 comments · Fixed by #3848
Closed

ucontext_t is missing on aarch64-unknown-freebsd #3217

jbeich opened this issue Apr 23, 2023 · 3 comments · Fixed by #3848
Labels
C-API-request Category: API request E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Milestone

Comments

@jbeich
Copy link

jbeich commented Apr 23, 2023

2e3999d added mcontext_t but not ucontext_t. FreeBSD ucontext_t is machine-independent but libc crate limits it by target_arch.

See ucontext_t definition vs. mcontext_t definition

error[E0412]: cannot find type `ucontext_t` in crate `libc`
   --> veloren-4b6c5f57e3a9/cargo-crates/wasmer-vm-2.3.0/src/trap/traphandlers.rs:219:57
    |
219 |               let ucontext = &mut *(context as *mut libc::ucontext_t);
    |                                                           ^^^^^^^^^^ help: a struct with a similar name exists: `mcontext_t`
    |
   ::: veloren-4b6c5f57e3a9/cargo-crates/libc-0.2.133/src/unix/bsd/freebsdlike/freebsd/aarch64.rs:20:1
    |
20  | / s_no_extra_traits! {
21  | |     pub struct gpregs {
22  | |         pub gp_x: [::register_t; 30],
23  | |         pub gp_lr: ::register_t,
..   |
44  | |     }
45  | | }
    | |_- similarly named struct `mcontext_t` defined here

error[E0412]: cannot find type `ucontext_t` in crate `libc`
   --> veloren-4b6c5f57e3a9/cargo-crates/wasmer-vm-2.3.0/src/trap/traphandlers.rs:259:45
    |
259 |           unsafe fn get_pc_sp(context: &libc::ucontext_t) -> (usize, usize) {
    |                                               ^^^^^^^^^^ help: a struct with a similar name exists: `mcontext_t`
    |
   ::: veloren-4b6c5f57e3a9/cargo-crates/libc-0.2.133/src/unix/bsd/freebsdlike/freebsd/aarch64.rs:20:1
    |
20  | / s_no_extra_traits! {
21  | |     pub struct gpregs {
22  | |         pub gp_x: [::register_t; 30],
23  | |         pub gp_lr: ::register_t,
..   |
44  | |     }
45  | | }
    | |_- similarly named struct `mcontext_t` defined here

error[E0412]: cannot find type `ucontext_t` in crate `libc`
   --> veloren-4b6c5f57e3a9/cargo-crates/wasmer-vm-2.3.0/src/trap/traphandlers.rs:314:54
    |
314 |           unsafe fn update_context(context: &mut libc::ucontext_t, regs: TrapHandlerRegs) {
    |                                                        ^^^^^^^^^^ help: a struct with a similar name exists: `mcontext_t`
    |
   ::: veloren-4b6c5f57e3a9/cargo-crates/libc-0.2.133/src/unix/bsd/freebsdlike/freebsd/aarch64.rs:20:1
    |
20  | / s_no_extra_traits! {
21  | |     pub struct gpregs {
22  | |         pub gp_x: [::register_t; 30],
23  | |         pub gp_lr: ::register_t,
..   |
44  | |     }
45  | | }
    | |_- similarly named struct `mcontext_t` defined here

error[E0425]: cannot find value `pc` in this scope
   --> veloren-4b6c5f57e3a9/cargo-crates/wasmer-vm-2.3.0/src/trap/traphandlers.rs:420:59
    |
420 |                     context.uc_mcontext.mc_gpregs.gp_pc = pc as libc::register_t;
    |                                                           ^^ not found in this scope

error[E0425]: cannot find value `sp` in this scope
   --> veloren-4b6c5f57e3a9/cargo-crates/wasmer-vm-2.3.0/src/trap/traphandlers.rs:421:59
    |
421 |                     context.uc_mcontext.mc_gpregs.gp_sp = sp as libc::register_t;
    |                                                           ^^ not found in this scope

error[E0425]: cannot find value `x0` in this scope
   --> veloren-4b6c5f57e3a9/cargo-crates/wasmer-vm-2.3.0/src/trap/traphandlers.rs:422:61
    |
422 |                     context.uc_mcontext.mc_gpregs.gp_x[0] = x0 as libc::register_t;
    |                                                             ^^ not found in this scope

error[E0425]: cannot find value `x1` in this scope
   --> veloren-4b6c5f57e3a9/cargo-crates/wasmer-vm-2.3.0/src/trap/traphandlers.rs:423:61
    |
423 |                     context.uc_mcontext.mc_gpregs.gp_x[1] = x1 as libc::register_t;
    |                                                             ^^ not found in this scope

error[E0425]: cannot find value `x29` in this scope
   --> veloren-4b6c5f57e3a9/cargo-crates/wasmer-vm-2.3.0/src/trap/traphandlers.rs:424:62
    |
424 |                     context.uc_mcontext.mc_gpregs.gp_x[29] = x29 as libc::register_t;
    |                                                              ^^^ not found in this scope

error[E0425]: cannot find value `lr` in this scope
   --> veloren-4b6c5f57e3a9/cargo-crates/wasmer-vm-2.3.0/src/trap/traphandlers.rs:425:62
    |
425 |                     context.uc_mcontext.mc_gpregs.gp_x[30] = lr as libc::register_t;
    |                                                              ^^ not found in this scope

Some errors have detailed explanations: E0412, E0425.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `wasmer-vm` due to 9 previous errors
@jbeich jbeich added the C-API-request Category: API request label Apr 23, 2023
@tgross35
Copy link
Contributor

Thanks for the report, feel free to put up a PR for this!

@tgross35 tgross35 added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. and removed help wanted labels Aug 29, 2024
@tgross35 tgross35 added this to the 1.x milestone Aug 29, 2024
@jbeich
Copy link
Author

jbeich commented Oct 23, 2024

libc-0.2 branch is still affected. What consumers are expected to do?

@tgross35
Copy link
Contributor

libc-0.2 branch is still affected. What consumers are expected to do?

The PR just didn't make the most recent backport. There are backports and new releases every couple weeks, it should be in the next one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-API-request Category: API request E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants