-
Notifications
You must be signed in to change notification settings - Fork 377
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
Missing intrinsic functions on aarch64/armv7 musl #985
Comments
Interestingly, this doesn't seem to reproduce in a simple package with a C++ dependency: $ cross +nightly --version
cross 0.2.4 (678e3d7 2022-07-29)
[cross] warning: using newer rustc `1.63.0-nightly (fee3a459d 2022-06-05)` for the target. Current active rustc on the host is `rustc 1.61.0 (fe5b13d68 2022-05-18)`.
> Update with `rustup update`
[cross] note: Falling back to `cargo` on the host.
cargo 1.63.0-nightly (38472bc19 2022-05-31)
$ git clone https://github.com/cross-rs/rust-cpp-hello-word
$ cd rust-cpp-hello-word
$ cross +nightly build --target armv7-unknown-linux-musleabihf -Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort
[cross] warning: using newer rustc `1.63.0-nightly (fee3a459d 2022-06-05)` for the target. Current active rustc on the host is `rustc 1.61.0 (fe5b13d68 2022-05-18)`.
> Update with `rustup update`
Compiling core v0.0.0 (/home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
Compiling std v0.0.0 (/home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std)
Compiling rustc-std-workspace-core v1.99.0 (/home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
Compiling compiler_builtins v0.1.73
Compiling libc v0.2.126
Compiling alloc v0.0.0 (/home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc)
Compiling cfg-if v0.1.10
Compiling rustc-demangle v0.1.21
Compiling unwind v0.0.0 (/home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/unwind)
Compiling rustc-std-workspace-alloc v1.99.0 (/home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-alloc)
Compiling panic_abort v0.0.0 (/home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/panic_abort)
Compiling panic_unwind v0.0.0 (/home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/panic_unwind)
Compiling std_detect v0.1.5 (/home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/stdarch/crates/std_detect)
Compiling hashbrown v0.12.0
Compiling proc_macro v0.0.0 (/home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro)
Compiling hellopp v0.1.0 (/mnt/c/Users/ahusz/git/rust-cpp-hello-word)
Finished dev [unoptimized + debuginfo] target(s) in 31.84s This does fail however for error: linking with `aarch64-linux-musl-gcc.sh` failed: exit status: 1
|
= note: "aarch64-linux-musl-gcc.sh" "/home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crt1.o" "/home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crti.o" "/home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crtbegin.o" "/tmp/rustcgsdU4c/symbols.o" "/target/aarch64-unknown-linux-musl/debug/deps/hellopp-e18a46c88e8651c0.17yj6cbrqsa7ydok.rcgu.o" "/target/aarch64-unknown-linux-musl/debug/deps/hellopp-e18a46c88e8651c0.31ozsu1nxvk40u8p.rcgu.o" "/target/aarch64-unknown-linux-musl/debug/deps/hellopp-e18a46c88e8651c0.3jb6c2penqwbl1tw.rcgu.o" "/target/aarch64-unknown-linux-musl/debug/deps/hellopp-e18a46c88e8651c0.43s4nhow0bh4mdu7.rcgu.o" "/target/aarch64-unknown-linux-musl/debug/deps/hellopp-e18a46c88e8651c0.4jh1kcigexzy7mj.rcgu.o" "/target/aarch64-unknown-linux-musl/debug/deps/hellopp-e18a46c88e8651c0.86k6xqe3mcfnldm.rcgu.o" "/target/aarch64-unknown-linux-musl/debug/deps/hellopp-e18a46c88e8651c0.37wbsb42mhp6kphi.rcgu.o" "-Wl,--as-needed" "-L" "/target/aarch64-unknown-linux-musl/debug/deps" "-L" "/target/debug/deps" "-L" "/target/aarch64-unknown-linux-musl/debug/build/hellopp-be12ba6d38a66dd4/out" "-L" "/home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib" "-Wl,-Bstatic" "-lhellopp" "-Wl,-Bdynamic" "-lstdc++" "-Wl,--start-group" "-Wl,-Bstatic" "/target/aarch64-unknown-linux-musl/debug/deps/libstd-2b9a1a9c35b1230a.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libpanic_unwind-d70e14d6e59177bc.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/librustc_demangle-f3d5b949b7b1a5de.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libstd_detect-59b5d3ce85adba29.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libhashbrown-2f24b7025c0e4078.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/librustc_std_workspace_alloc-f93333caf4316797.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libunwind-755d10c7440dc2d0.rlib" "-lunwind" "/target/aarch64-unknown-linux-musl/debug/deps/libcfg_if-22929b06043a7aec.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/liblibc-3e7ed81f524f85a0.rlib" "-lc" "/target/aarch64-unknown-linux-musl/debug/deps/liballoc-64350ab48d7b62c5.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/librustc_std_workspace_core-ab8f7e806a10a573.rlib" "/target/aarch64-unknown-linux-musl/debug/deps/libcore-b2d649ba95a0a0a1.rlib" "-Wl,--end-group" "/target/aarch64-unknown-linux-musl/debug/deps/libcompiler_builtins-d8af7abe78822f7d.rlib" "-Wl,-Bdynamic" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-nostartfiles" "-L" "/home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib" "-L" "/home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained" "-o" "/target/aarch64-unknown-linux-musl/debug/deps/hellopp-e18a46c88e8651c0" "-Wl,--gc-sections" "-static" "-no-pie" "-Wl,-zrelro,-znow" "-nodefaultlibs" "/home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crtend.o" "/home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crtn.o"
= note: + set -euo pipefail
+ main /home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crt1.o /home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crti.o /home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crtbegin.o /tmp/rustcgsdU4c/symbols.o /target/aarch64-unknown-linux-musl/debug/deps/hellopp-e18a46c88e8651c0.17yj6cbrqsa7ydok.rcgu.o /target/aarch64-unknown-linux-musl/debug/deps/hellopp-e18a46c88e8651c0.31ozsu1nxvk40u8p.rcgu.o /target/aarch64-unknown-linux-musl/debug/deps/hellopp-e18a46c88e8651c0.3jb6c2penqwbl1tw.rcgu.o /target/aarch64-unknown-linux-musl/debug/deps/hellopp-e18a46c88e8651c0.43s4nhow0bh4mdu7.rcgu.o /target/aarch64-unknown-linux-musl/debug/deps/hellopp-e18a46c88e8651c0.4jh1kcigexzy7mj.rcgu.o /target/aarch64-unknown-linux-musl/debug/deps/hellopp-e18a46c88e8651c0.86k6xqe3mcfnldm.rcgu.o /target/aarch64-unknown-linux-musl/debug/deps/hellopp-e18a46c88e8651c0.37wbsb42mhp6kphi.rcgu.o -Wl,--as-needed -L /target/aarch64-unknown-linux-musl/debug/deps -L /target/debug/deps -L /target/aarch64-unknown-linux-musl/debug/build/hellopp-be12ba6d38a66dd4/out -L /home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib -Wl,-Bstatic -lhellopp -Wl,-Bdynamic -lstdc++ -Wl,--start-group -Wl,-Bstatic /target/aarch64-unknown-linux-musl/debug/deps/libstd-2b9a1a9c35b1230a.rlib /target/aarch64-unknown-linux-musl/debug/deps/libpanic_unwind-d70e14d6e59177bc.rlib /target/aarch64-unknown-linux-musl/debug/deps/librustc_demangle-f3d5b949b7b1a5de.rlib /target/aarch64-unknown-linux-musl/debug/deps/libstd_detect-59b5d3ce85adba29.rlib /target/aarch64-unknown-linux-musl/debug/deps/libhashbrown-2f24b7025c0e4078.rlib /target/aarch64-unknown-linux-musl/debug/deps/librustc_std_workspace_alloc-f93333caf4316797.rlib /target/aarch64-unknown-linux-musl/debug/deps/libunwind-755d10c7440dc2d0.rlib -lunwind /target/aarch64-unknown-linux-musl/debug/deps/libcfg_if-22929b06043a7aec.rlib /target/aarch64-unknown-linux-musl/debug/deps/liblibc-3e7ed81f524f85a0.rlib -lc /target/aarch64-unknown-linux-musl/debug/deps/liballoc-64350ab48d7b62c5.rlib /target/aarch64-unknown-linux-musl/debug/deps/librustc_std_workspace_core-ab8f7e806a10a573.rlib /target/aarch64-unknown-linux-musl/debug/deps/libcore-b2d649ba95a0a0a1.rlib -Wl,--end-group /target/aarch64-unknown-linux-musl/debug/deps/libcompiler_builtins-d8af7abe78822f7d.rlib -Wl,-Bdynamic -Wl,--eh-frame-hdr -Wl,-znoexecstack -nostartfiles -L /home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib -L /home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained -o /target/aarch64-unknown-linux-musl/debug/deps/hellopp-e18a46c88e8651c0 -Wl,--gc-sections -static -no-pie -Wl,-zrelro,-znow -nodefaultlibs /home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crtend.o /home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crtn.o
+ local release=
++ rustc -Vv
++ grep '^release:'
++ cut -d : -f2
+ release=' 1.63.0-nightly'
+ local minor=
++ echo ' 1.63.0-nightly'
++ cut -d . -f2
+ minor=63
+ (( minor >= 48 ))
+ aarch64-linux-musl-gcc /home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crt1.o /home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crti.o /home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crtbegin.o /tmp/rustcgsdU4c/symbols.o /target/aarch64-unknown-linux-musl/debug/deps/hellopp-e18a46c88e8651c0.17yj6cbrqsa7ydok.rcgu.o /target/aarch64-unknown-linux-musl/debug/deps/hellopp-e18a46c88e8651c0.31ozsu1nxvk40u8p.rcgu.o /target/aarch64-unknown-linux-musl/debug/deps/hellopp-e18a46c88e8651c0.3jb6c2penqwbl1tw.rcgu.o /target/aarch64-unknown-linux-musl/debug/deps/hellopp-e18a46c88e8651c0.43s4nhow0bh4mdu7.rcgu.o /target/aarch64-unknown-linux-musl/debug/deps/hellopp-e18a46c88e8651c0.4jh1kcigexzy7mj.rcgu.o /target/aarch64-unknown-linux-musl/debug/deps/hellopp-e18a46c88e8651c0.86k6xqe3mcfnldm.rcgu.o /target/aarch64-unknown-linux-musl/debug/deps/hellopp-e18a46c88e8651c0.37wbsb42mhp6kphi.rcgu.o -Wl,--as-needed -L /target/aarch64-unknown-linux-musl/debug/deps -L /target/debug/deps -L /target/aarch64-unknown-linux-musl/debug/build/hellopp-be12ba6d38a66dd4/out -L /home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib -Wl,-Bstatic -lhellopp -Wl,-Bdynamic -lstdc++ -Wl,--start-group -Wl,-Bstatic /target/aarch64-unknown-linux-musl/debug/deps/libstd-2b9a1a9c35b1230a.rlib /target/aarch64-unknown-linux-musl/debug/deps/libpanic_unwind-d70e14d6e59177bc.rlib /target/aarch64-unknown-linux-musl/debug/deps/librustc_demangle-f3d5b949b7b1a5de.rlib /target/aarch64-unknown-linux-musl/debug/deps/libstd_detect-59b5d3ce85adba29.rlib /target/aarch64-unknown-linux-musl/debug/deps/libhashbrown-2f24b7025c0e4078.rlib /target/aarch64-unknown-linux-musl/debug/deps/librustc_std_workspace_alloc-f93333caf4316797.rlib /target/aarch64-unknown-linux-musl/debug/deps/libunwind-755d10c7440dc2d0.rlib -lunwind /target/aarch64-unknown-linux-musl/debug/deps/libcfg_if-22929b06043a7aec.rlib /target/aarch64-unknown-linux-musl/debug/deps/liblibc-3e7ed81f524f85a0.rlib -lc /target/aarch64-unknown-linux-musl/debug/deps/liballoc-64350ab48d7b62c5.rlib /target/aarch64-unknown-linux-musl/debug/deps/librustc_std_workspace_core-ab8f7e806a10a573.rlib /target/aarch64-unknown-linux-musl/debug/deps/libcore-b2d649ba95a0a0a1.rlib -Wl,--end-group /target/aarch64-unknown-linux-musl/debug/deps/libcompiler_builtins-d8af7abe78822f7d.rlib -Wl,-Bdynamic -Wl,--eh-frame-hdr -Wl,-znoexecstack -nostartfiles -L /home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib -L /home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained -o /target/aarch64-unknown-linux-musl/debug/deps/hellopp-e18a46c88e8651c0 -Wl,--gc-sections -static -no-pie -Wl,-zrelro,-znow -nodefaultlibs /home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crtend.o /home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/crtn.o
/usr/local/bin/../lib/gcc/aarch64-linux-musl/9.2.0/../../../../aarch64-linux-musl/bin/ld: /home/ahusz/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-musl/lib/self-contained/libc.a(fmodl.lo): undefined reference to symbol '__letf2@@GCC_3.0'
/usr/local/bin/../lib/gcc/aarch64-linux-musl/9.2.0/../../../../aarch64-linux-musl/bin/ld: /usr/local/bin/../aarch64-linux-musl/lib/libgcc_s.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
= help: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
= note: use the `-l` flag to specify native libraries to link
= note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)
error: could not compile `hellopp` due to previous error Or, missing the |
This seems to be related to, but not exactly the same as, rust-lang/rust#46651, which was a previous issue for our This is probably a generic musl issue, and upstream in Rust itself. A simple temporary fix though is to always link to |
The patch in #986 seems to fix this issue: if you want to test the above patch to see if it works, let me know. I've tried using your fork of |
Missing Some of the other missing intrinsics seem to be due to https://github.com/NobodyXu/cargo-binstall/runs/7576062950?check_suite_focus=true#step:11:250 We can clearly see from the source that these symbols should be defined: |
Thanks, I will have a try later.
I only disable the panic unwind/backtract/fmt-message stuff, so I am pretty sure I didn't disable that. |
Actually, this might be an issue due to not having the |
This has now been fully documented on the wiki. Let me know if anything is unclear so we can improve the documentation. |
Thanks, this fixed the problem for me! |
Checklist
Describe your issue
When using
-Z build-std=std,panic_abort -Z build-std-features=panic_immediate_abort
on nightly, the CI forarmv7-unknown-linux-musleabihf
failed with:And the CI for aarch64-unknown-linux-musl failed with similar error.
What target(s) are you cross-compiling for?
aarch64-unknown-linux-musl, armv7-unknown-linux-musleabihf
Which operating system is the host (e.g computer cross is on) running?
What architecture is the host?
What container engine is cross using?
cross version
cross 0.2.4 (4645d93 2022-07-10)
Example
cross
seems to have missing intrinsic functions on aarch64/armv7 musl build when usingbuild-std
features:It only happens if we have the
build-std
configurations.Additional information / notes
This might be related to #896
This issue was discovered in cargo-bins/cargo-binstall#256 .
The text was updated successfully, but these errors were encountered: