Open
Description
I tried this code:
Trying to cross compile (from aarch64 to x86_86 on linux)
I expected to see this happen: explanation
The software compiled correctly.
Instead, this happened: explanation
The linker failed on trying to link Rust's libstd.
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: /usr/x86_64-linux-gnu/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000000005030
/usr/x86_64-linux-gnu/bin/ld: /home/debian/.rustup/toolchains/stable-aarch64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-f6265b21db1f990f.rlib(std-f6265b21db1f990f.std.d9e466a2d75004a2-cgu.0.rcgu.o):(.data._
rust_extern_with_linkage___dso_handle+0x0): undefined reference to `__dso_handle'
/usr/x86_64-linux-gnu/bin/ld: /home/debian/envoy-cli/target/x86_64-unknown-linux-gnu/debug/deps/oktaplz-a2cfe24976663532: hidden symbol `__dso_handle' isn't defined
/usr/x86_64-linux-gnu/bin/ld: final link failed: bad value
Meta
rustc --version --verbose
:
1.81
Backtrace
<backtrace>
This does work correctly on rust 1.74.0 on the same system. I have been unable to test other versions yet, nor create a self-contained example.
The build command for this is:
RUSTFLAGS="-Clinker=/usr/x86_64-linux-gnu/bin/ld -L/lib/gcc-cross/x86_64-linux-gnu/12 -L/lib/gcc-cross/x86_64-linux-gnu/11" PKG_CONFIG_SYSROOT_DIR=/usr/x86_64-linux-gnu CC=clang cargo build --target x86_64-unknown-linux-gnu
Metadata
Metadata
Assignees
Labels
Area: Cross compilationArea: linking into static, shared libraries and binariesCategory: This is a bug.Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleRelevant to the compiler team, which will review and decide on the PR/issue.