Skip to content

"cannot find value REG_EIP in crate libc" when targetting i686-unknown-linux-musl #2787

Open
@victorpaleologue

Description

@victorpaleologue

Trying to build wasmtime for the i686-unknown-linux-musl target leads to the following error:

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

It seems libc is lacking few elements for this target platform specifically.

Specific steps to reproduce the issue on a Mac M1:

brew tap messense/macos-cross-toolchains
brew install i686-unknown-linux-musl
rustup target add i686-unknown-linux-musl
git clone git@github.com:bytecodealliance/wasmtime.git --recurse-submodules
cd wasmtime
CC_i686_unknown_linux_musl=/opt/homebrew/Cellar/i686-unknown-linux-musl/11.2.0/bin/i686-unknown-linux-musl-gcc CXX_i686_unknown_linux_musl=/opt/homebrew/Cellar/i686-unknown-linux-musl/11.2.0/bin/i686-unknown-linux-musl-g++ AR_i686_unknown_linux_musl=/opt/homebrew/Cellar/i686-unknown-linux-musl/11.2.0/bin/i686-unknown-linux-musl-ar CARGO_TARGET_I686_UNKNOWN_LINUX_MUSL_LINKER=/opt/homebrew/Cellar/i686-unknown-linux-musl/11.2.0/bin/i686-unknown-linux-musl-gcc cargo build --target i686-unknown-linux-musl

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bugE-mediumE-medium Call for participation: Medium difficulty. Experience needed to fix: Intermediate.O-musl

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions