self-contained linker: retry linking without -fuse-ld=lld on CCs that don't support it by lqd · Pull Request #125417 · rust-lang/rust (original) (raw)

@VorpalBlade I couldn't test with cross as you described in #125330, the issue doesn't reproduce for me locally. I'm not sure if cross' images may have changed in the last few days, but it doesn't look like it in the cross repository. From a quick look at their commits, it seemed there wasn't any that would help fix this issue either.

Here, cargo add syn && cross +nightly build --target aarch64-unknown-linux-gnu succeeds. The binary's .comment looks like it used at least 1 GCC in the docker image that supports -fuse-ld=lld, which could explain why it worked.

$ readelf -p .comment target/aarch64-unknown-linux-gnu/debug/helloworld

String dump of section '.comment': [ 0] GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0 [ 2b] rustc version 1.80.0-nightly (b92758a9a 2024-05-20) [ 5f] GCC: (crosstool-NG UNKNOWN) 8.5.0

I don't know if you have another way to reproduce this issue that I could try?

I've tested on a CentOS7 image with gcc 4.5 and a helloworld worked there, so I have high hopes it will fix your use-case but I'd like to make sure with an actual reproduction.


Otherwise, I've asked CI to do a try build, which is similar to a rustup toolchain for this PR, and maybe you would be able to test it where nightly fails?

With rustup-toolchain-install-master, we can install CI artifacts and use them as regular rustup toolchains.

When CI completes (the bot will post a message that the build was successful), rustup-toolchain-install-master 5572f385cb1b21326f0cf6672b3f74a172b5dcfa will install the toolchain, and you'd be able to use it where you encountered the issue: with +nightly replaced by +5572f385cb1b21326f0cf6672b3f74a172b5dcfa.

To be honest I have a suspicion this might also fail, for unrelated reasons: I don't believe CI will build other std targets here, unfortunately. That seemed necessary in the cross-compilation use-case, but maybe cargo's -Zbuild-std could work here and build std. That's why I'm still mentioning this possibility.