-
Notifications
You must be signed in to change notification settings - Fork 56
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
Template fails on NixOS with 'collect2: ld not found' because -fuse-ld=mold
is injected into the build process
#257
Comments
I do not run nixos so I cannot really try to reproduce your problem. With that said,
This is not done by |
if this is not clear, |
Turns out the problem was a default in devenv that overrrode the RUSTFLAGS to force mold as the linker. This way the modified ld couldn't be found and so on. So, literally languages.rust = {
enable = true;
channel = "nightly";
components = [ "rustc" "rust-src" "cargo" "clippy" "rustfmt" "rust-analyzer" ];
mold.enable = false;
}; Personally I think making it the default behaviour to override the default settings of another program is nonsense and i am going to open up an issue over there. Thanks for your help and confirming this is not an esp-rs/esp-idf issue. |
I just generated a project using the template and the cargo option. Building it fails at the final linking step because
ld
(the linker) could not be found. After doingcargo build -vv
and running the final link command manually with strace, i could see which paths collect2 searches forld
. due to-fuse-ld=mold
being (somehow) added to RUSTFLAGS and in turn ldproxy (which then calls gcc, which then calls collect2, which then wrongfully looks forld.mold
), it only searches forld.mold
in the compiler directories (.embuild/espressif/...
)- which predictably can't be found. When running the final link command manually without the-fuse-ld
argument, the linker can proceed, although it then fails due to some strings in thecargo build -vv
output like "<4 objects omitted>". Do you know where the-fuse-ld=mold
is set in the build process and how I can unset it?Here's a repro (including nix flake): https://github.com/leonhma/esprs/tree/6f2da8f16b3646e9498190e5c3835647f4550f2d
The text was updated successfully, but these errors were encountered: