Stream: git-wasmtime

Topic: wasmtime / issue #4137 "cannot find value `REG_EIP` in cr...


view this post on Zulip Wasmtime GitHub notifications bot (May 11 2022 at 10:52):

victorpaleologue opened issue #4137:

I am packaging an application using using the toolchain i686-unknown-linux-musl. Like @ifreund I had an issue because some libc details used by wasmtime are absent in that toolchain.

error[E0425]: cannot find value `REG_EIP` in crate `libc`
   --> /Users/victor.paleologue/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmtime-runtime-0.33.1/src/traphandlers/unix.rs:173:40
    |
173 |             cx.uc_mcontext.gregs[libc::REG_EIP as usize] as *const u8
    |                                        ^^^^^^^ not found in `libc`

error[E0609]: no field `gregs` on type `mcontext_t`
   --> /Users/victor.paleologue/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmtime-runtime-0.33.1/src/traphandlers/unix.rs:173:28
    |
173 |             cx.uc_mcontext.gregs[libc::REG_EIP as usize] as *const u8
    |                            ^^^^^ unknown field

Reading
the following code, it looks like wasmtime is intended to support x86 on linux:

        } else if #[cfg(all(target_os = "linux", target_arch = "x86"))] {
            let cx = &*(cx as *const libc::ucontext_t);
            cx.uc_mcontext.gregs[libc::REG_EIP as usize] as *const u8

I'm using rust 1.61.0 and wasmtime 0.33.1.

view this post on Zulip Wasmtime GitHub notifications bot (May 11 2022 at 10:53):

victorpaleologue edited issue #4137:

I am packaging an application using using the toolchain i686-unknown-linux-musl. Like @ifreund I had an issue because some libc details used by wasmtime are absent in that toolchain.

error[E0425]: cannot find value `REG_EIP` in crate `libc`
   --> /Users/victor.paleologue/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmtime-runtime-0.33.1/src/traphandlers/unix.rs:173:40
    |
173 |             cx.uc_mcontext.gregs[libc::REG_EIP as usize] as *const u8
    |                                        ^^^^^^^ not found in `libc`

error[E0609]: no field `gregs` on type `mcontext_t`
   --> /Users/victor.paleologue/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmtime-runtime-0.33.1/src/traphandlers/unix.rs:173:28
    |
173 |             cx.uc_mcontext.gregs[libc::REG_EIP as usize] as *const u8
    |                            ^^^^^ unknown field

Reading
the following code, it looks like wasmtime is intended to support x86 on linux:

        } else if #[cfg(all(target_os = "linux", target_arch = "x86"))] {
            let cx = &*(cx as *const libc::ucontext_t);
            cx.uc_mcontext.gregs[libc::REG_EIP as usize] as *const u8

I'm using rust 1.61.0 and wasmtime 0.33.1.

Do you think this is an issue of the toolchain, or of wasmtime?

view this post on Zulip Wasmtime GitHub notifications bot (May 11 2022 at 11:01):

victorpaleologue edited issue #4137:

I am packaging an application using using the toolchain i686-unknown-linux-musl. Like @ifreund I had an issue because some libc details used by wasmtime are absent in that toolchain.

error[E0425]: cannot find value `REG_EIP` in crate `libc`
   --> /Users/victor.paleologue/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmtime-runtime-0.33.1/src/traphandlers/unix.rs:173:40
    |
173 |             cx.uc_mcontext.gregs[libc::REG_EIP as usize] as *const u8
    |                                        ^^^^^^^ not found in `libc`

error[E0609]: no field `gregs` on type `mcontext_t`
   --> /Users/victor.paleologue/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmtime-runtime-0.33.1/src/traphandlers/unix.rs:173:28
    |
173 |             cx.uc_mcontext.gregs[libc::REG_EIP as usize] as *const u8
    |                            ^^^^^ unknown field

Reading
the following code, it looks like wasmtime is intended to support x86 on linux:

        } else if #[cfg(all(target_os = "linux", target_arch = "x86"))] {
            let cx = &*(cx as *const libc::ucontext_t);
            cx.uc_mcontext.gregs[libc::REG_EIP as usize] as *const u8

I'm using rust 1.61.0 and wasmtime 0.33.1.

Do you think this is an issue of the toolchain, or of wasmtime?

view this post on Zulip Wasmtime GitHub notifications bot (May 11 2022 at 11:44):

bjorn3 commented on issue #4137:

It looks like that will need to be changed in the libc crate. https://github.com/rust-lang/libc

view this post on Zulip Wasmtime GitHub notifications bot (May 11 2022 at 16:58):

cfallin commented on issue #4137:

@victorpaleologue unfortunately, Wasmtime does not support 32-bit x86.

The code in the trap handler support that you link to was probably written in anticipation of x86-32, or copied from somewhere else, or I'm not sure, but... our compiler (Cranelift) does not support the platform, so that's the most fundamental issue. We are tracking this in #1980.

We'd love to fix that, but it's a nontrivial amount of work and no one has had the time so far; volunteers welcome!

In the meantime I'll go ahead and close this in favor of #1980.

view this post on Zulip Wasmtime GitHub notifications bot (May 11 2022 at 16:58):

cfallin closed issue #4137:

I am packaging an application using using the toolchain i686-unknown-linux-musl. Like @ifreund I had an issue because some libc details used by wasmtime are absent in that toolchain.

error[E0425]: cannot find value `REG_EIP` in crate `libc`
   --> /Users/victor.paleologue/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmtime-runtime-0.33.1/src/traphandlers/unix.rs:173:40
    |
173 |             cx.uc_mcontext.gregs[libc::REG_EIP as usize] as *const u8
    |                                        ^^^^^^^ not found in `libc`

error[E0609]: no field `gregs` on type `mcontext_t`
   --> /Users/victor.paleologue/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmtime-runtime-0.33.1/src/traphandlers/unix.rs:173:28
    |
173 |             cx.uc_mcontext.gregs[libc::REG_EIP as usize] as *const u8
    |                            ^^^^^ unknown field

Reading
the following code, it looks like wasmtime is intended to support x86 on linux:

        } else if #[cfg(all(target_os = "linux", target_arch = "x86"))] {
            let cx = &*(cx as *const libc::ucontext_t);
            cx.uc_mcontext.gregs[libc::REG_EIP as usize] as *const u8

I'm using rust 1.61.0 and wasmtime 0.33.1.

Do you think this is an issue of the toolchain, or of wasmtime?


Last updated: Nov 22 2024 at 17:03 UTC