rust_extern_with_linkage___dso_handle+0x0): undefined reference to `__dso_handle'
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the provided cargo build command on the aarch64-to-x86_64 setup and compare Rust 1.74.0 with 1.81. Inspect the libstd linker invocation and the reported __dso_handle reference, using verbose linker arguments to narrow the regression. Done means identifying a reproducible cause and a validated fix or regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100