Change:
Cross compiling fails with the linker being unable to find , and code: I'm compiling the default hello-world application, and it works fine for in addition to working fine for . 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:
Yeah this is a known issue which needs to be fixed in the compiler_builtins crate. See
I guess my followup is why is an allowed target in Rust if doesn't exist in the language and linking anything doesn't work.
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, 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
just mentioned this as only-working-with-workaround (). Reopening as requested by because of reverted fix PR
I was anyway able to cross-compile to aarch64 musl target using this .cargo/config (thanks for the workaround!):
solution worked for me on Windows I still had to for the moment, not sure how to get to ask for the right one.
So, what exactly is needed to fix this without the ?
is quadruple precision add, is quadruple precision multiplication and is quadruple precision substruction. the symbol is equal to this C function: from gcc and from llvm compiler-rt provide the implement of , and . In rust we use compiler-builtins (writing in rust) to replace llvm compiler-rt (writing in c and llvm asm) quadruple precision, and in C, means 128bit float number, but rust don't have type, so those A temporary fix is linking to or , but permanent fix won't exist until rust have
The crate now has an implementation for AArch64 long double intrinsics, so this issue is solved in most cases. However, because coming from , using in combination with may not enable the , causing this issue to users of and in the latest Rust builds. Therefore, users of may still need to work around this issue by either: Linking with the GCC intrinsics implementation (), as mentioned above. Explicitly build with the feature, by setting and setting up the environment variable to the path to the source, similarly to : The second option is more complex to set up, but it should produce outputs closer to the usual pre-built Rust binaries.

Discussion:
[[package]] name = "compiler_builtins" <del> version = "0.1.32" </del> <ins> version = "0.1.35" </ins> source = "registry+https://github.com/rust-lang/crates.io-index" <del> checksum = "7bc4ac2c824d2bfc612cba57708198547e9a26943af0632aff033e0693074d5c" </del> <ins> checksum = "e3fcd8aba10d17504c87ef12d4f62ef404c6a4703d16682a9eb5543e6cf24455" </ins> dependencies = [ "cc", "rustc-std-workspace-core",

panic_abort = { path = "../panic_abort" } core = { path = "../core" } libc = { version = "0.2.74", default-features = false, features = ['rustc-dep-of-std'] } <del> compiler_builtins = { version = "0.1.32" } </del> <ins> compiler_builtins = { version = "0.1.35" } </ins> profiler_builtins = { path = "../profiler_builtins", optional = true } unwind = { path = "../unwind" } hashbrown = { version = "0.8.1", default-features = false, features = ['rustc-dep-of-std'] }