-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Crate fails to link for mips-unknown-linux-musl target with mips-linux-gnu-gcc compiler #57820
Comments
The necessary functions should be added to the compiler-builtins. |
This does look like an interesting idea, but when trying to compile with that crate, I get lots of errors of this sort:
You should be able to recreate this by adding the following line to the
I'm currently working on a project that I'd like to keep on the stable channel. Will this crate not work at all on the stable channel? |
@rustbot modify labels: +O-musl |
possibly related to #61328 |
Any updates with this issue? Have the same problem |
Adding "-C", "link-args=-lgcc" to re-add libgcc removed by -nostdlib to rustargs fixes the problem, at least for the simple hello world. Or you could implement __bswapsi2 yourself. I'm guessing that openwrt toolchain targets mips32 as opposed of mips32r2, so it requires "libcall" for bswap. Hope it helps. |
It works, thanks! |
This adds compiler-rt fallbacks for mips and mips64 arches. Solves linking issues like rust-lang/rust#57820. Signed-off-by: Yuxiang Zhu <[email protected]>
This adds compiler-rt fallbacks for mips and mips64 arches. Solves linking issues like rust-lang/rust#57820. Signed-off-by: Yuxiang Zhu <[email protected]>
This adds compiler-rt fallbacks for mips and mips64 arches. Solves linking issues like rust-lang/rust#57820. Signed-off-by: Yuxiang Zhu <[email protected]>
This adds compiler-rt fallbacks for mips and mips64 arches. Solves linking issues like rust-lang/rust#57820. Signed-off-by: Yuxiang Zhu <[email protected]>
This adds compiler-rt fallbacks for mips and mips64 arches. Solves linking issues like rust-lang/rust#57820. Signed-off-by: Yuxiang Zhu <[email protected]>
Update compiler-builtins Update the compiler-builtins dependency to include latest changes. This allows for `aarch64-unknown-linux-musl` to pass all tests. Fixes rust-lang#57820 and fixes rust-lang#46651
Update compiler-builtins Update the compiler-builtins dependency to include latest changes. This allows for `aarch64-unknown-linux-musl` to pass all tests. Fixes rust-lang#57820 and fixes rust-lang#46651
Summary
When building a statically-linked Rust binary crate for the
mips-unknown-linux-musl
target, linking a crate fails with the following error:Expected result: the crate successfully compiles.
Actual result: the crate fails to compile, with an error during the linking stage.
Platform: Ubuntu 18.04, x86_64.
Output of
rustc --version --verbose
:MUSL standard C library version: 1.1.20.
C compiler: MIPS GCC version 7.3, provided by Ubuntu 18.04 (
gcc-mips-linux-gnu
).I tried searching the open and closed issues for this project, and couldn't find any others exhibiting this same error.
More Detail
Forgive me if this is the wrong place to file this bug, but I'm not entirely sure how to debug this problem, so I'm starting here with Rust.
The file
elf.c
inlibbacktrace
makes a call to__builtin_bswap32
on big-endian hosts (see source code here). This function gets translated into the symbol__bswapsi2
for the MIPS target, and should be present in the compiler's built-in library, but it appears it's absent here.Now, I can see that the Rust CI build for the MIPS MUSL target uses GCC 5.3 from the OpenWRT toolchain. I'm not entirely sure why this should give any different results from using the GCC 7.3 package provided by Ubuntu 18.04 (
gcc-mips-linux-gnu
). I've also tried this experiment using thegcc-5-mips-linux-gnu
Ubuntu package, which provides GCC 5.5, and the results are the same (fails to link due to undefined reference to__bswapsi2
).Here is the full error message from trying to build the crate:
How to Reproduce
An easy way to reproduce this is to create a
Dockerfile
with the following contents, and then build it withdocker build .
:The text was updated successfully, but these errors were encountered: