Open pimeys opened 2 days ago
For one reason or another the linker is using glibc's version of libm rather than musl's version of libm. I'm not sure why that happens,. In any case you shouldn't need musl installed on the host system, nor use musl-gcc. Rustc already ships with a copy of musl's libc.a which includes libm.
This might be it. I installed a clean debian container to test this out and some dependency didn't build due to missing musl-gcc... I will get back to this when I'm on my computer again.
So, this is what I found out:
I wonder how common these kind of issues are with musl? We do have several sys dependencies which contain C code and which compile just fine against musl. But why did the wasmtime 22 update break the linking?
I did a git-bisect today trying to find which commit broke the build and I think I found it:
Ping @alexcrichton
Removing these lines from build.rs fixes the issue. But this probably breaks something else...
Test Case
I'm sorry I cannot find an isolated example for you to test with a small dependency tree, but in our repo, when we updated wasmtime from 21.0.1 to 22.0.0 we suddenly started having issues linking the binary when compiling against musl target.
Here's the branch:
https://github.com/grafbase/grafbase/pull/1840
And the error we see when linking:
We can currently work with the previous version, but this issue prevents us from updating to the latest runtime.
Steps to Reproduce
cargo build -p grafbase-gateway --release --target x86_64-unknown-linux-musl
Expected Results
The project compiles correctly into a working binary.
Actual Results
Linking fails as explained in the first chapter.
Versions and Environment
Wasmtime version or commit: 22.0.0
Operating system: NixOS unstable and Debian Bookworm
Architecture: x86_64-unknown-linux-musl
Extra Info
This is most probably some issue with wasmtime and some other crate together. I could not reduce a nice and clean repro as a new project. Been trying to get that the whole afternoon... But something definitely broke in the latest update of wasmtime.