-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Cannot cross-compile aarch64-musl on x86_64 linux #46651
Cannot cross-compile aarch64-musl on x86_64 linux #46651
Comments
Yeah this is a known issue which needs to be fixed in the compiler_builtins crate. See rust-lang/compiler-builtins#201 |
I guess my followup is why is |
Good question, it's not entirely clear to me if it's actually compiler_builtins responsibility to provide these. For now you should be fine if you also link libgcc. |
Is there any workaround? Say, some combination of #[cfg(link...)] and |
It would be greatly appreciated if anyone could provide any ideas for any kind of temporary workaround for this until it is properly fixed. I don't care if certain functionality (such as 128-bit integers or whatever) doesn't work. Being able to build static musl executables for aarch64 would be very useful to me. |
Does linking libgcc not work? |
There are some use-cases for 64-bit statically linking with musl: for example, SailfishX sports a 64-bit Linux kernel and 32-bit only apps/libs (no 64-bit ld-linux*.so installed). A 64-bit statically linked executable would work out of the box. |
In case anyone is blocked on this, here's a workaround:
|
This should be reopened due to rust-lang/libc#1045 |
I was anyway able to cross-compile to aarch64 musl target using this .cargo/config (thanks for the workaround!):
|
@ciofeca's solution worked for me on Windows |
So, what exactly is needed to fix this without the |
the symbol
In rust we use compiler-builtins (writing in rust) to replace llvm compiler-rt (writing in c and llvm asm) quadruple precision, and A temporary fix is linking to |
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
464: aarch64-unknown-linux-musl: do not set RUSTFLAGS r=reitermarkus a=jonas-schievink rust-lang/rust#46651 has been fixed, and this helps with #463 Co-authored-by: Jonas Schievink <jonasschievink@gmail.com> Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
464: aarch64-unknown-linux-musl: do not set RUSTFLAGS r=reitermarkus a=jonas-schievink rust-lang/rust#46651 has been fixed, and this helps with #463 Co-authored-by: Jonas Schievink <jonasschievink@gmail.com> Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
497: don't set RUSTFLAGS in aarch64-musl image r=reitermarkus a=japaric instead use a linker wrapper to work around issue rust-lang/rust#46651 not setting RUSTFLAGS inside the container lets end users pass rustc flags via `.cargo/config` this is an alternative to #464 that doesn't require bumping the MSRV of the `aarch64-unknown-linux-musl` target (that is the aarch64-musl image will continue to work with Rust 1.42 where bug rust-lang/rust#46651 is still presen ) 500: use runner setting specified in Cross.toml r=reitermarkus a=japaric fixes #499 Co-authored-by: Jorge Aparicio <jorge.aparicio@ferrous-systems.com>
497: don't set RUSTFLAGS in aarch64-musl image r=reitermarkus a=japaric instead use a linker wrapper to work around issue rust-lang/rust#46651 not setting RUSTFLAGS inside the container lets end users pass rustc flags via `.cargo/config` this is an alternative to #464 that doesn't require bumping the MSRV of the `aarch64-unknown-linux-musl` target (that is the aarch64-musl image will continue to work with Rust 1.42 where bug rust-lang/rust#46651 is still presen ) Co-authored-by: Jorge Aparicio <jorge.aparicio@ferrous-systems.com>
The However, because these intrinsics are implemented using C functions coming from LLVM's Therefore, users of
The second option is more complex to set up, but it should produce outputs closer to the usual pre-built Rust |
Cross compiling fails with the linker being unable to find
__addtf3
,__multf3
and__subtf3
code:
I'm compiling the default hello-world application, and it works fine for
aarch64-unknown-linux-gnu
in addition to working fine forarm-unknown-linux-musleabihf
. I installed musl the same way for both aarch64 and for armhf, so I'm not sure what the issue would be.Furthermore, I can compile a simple hello-world application written in C with the musl standard library just fine.
Note: I have encountered this issue both in Arch Linux with the 4.14.4 kernel and Ubuntu 16.04 with the 4.4.0 kernel.
version info for the output below, although this happens with nightly and stable:
output:
The text was updated successfully, but these errors were encountered: