-
Notifications
You must be signed in to change notification settings - Fork 424
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
GCC cannot find linker when rustc invoked with #1114
Comments
That's interesting - I would have expected at least |
Yeah, it turns out the symlink alraedy exists in my environment:
|
worth noting, this isn't specific to gold. If I remove |
This definitely feels like something the This is where we currently get the env vars to set for the linker to work: rules_rust/rust/private/rustc.bzl Lines 292 to 296 in c435cf4
As far as I can tell, this is doing the right thing, which suggests you may need to modify your |
I actually fixed this for the case where the gcc and ld were not in the same directory. However, if you are using gold, I didn't fix that case as I didn't know how to fix it. Let me find my commit on bazel. It should be a pretty easy fix. Specifically, the following lines need to be pulled out of the conditional block and do the right thing for the gold case: A little more context, the Also, I think it's important to note that this is not a rules_rust issue. It's a bazel issue. |
And here's a diff to work around this in your local rules_rust before bazel is updated to fix the problem:
|
Actually, now this diff is still required in my internal rules_rust to make builds work. I think some variation of this patch needs to make it into rules_rust. I suspect with my change there may be a better way to get the |
Hi,
We have a bazel setup with a
cc_toolchain
configured to use gold via--fuse-ld=gold
. When rules rust runs rustc it forwards the linker flags configured in thecc_toolchain
to rustc with--codegen 'link-args=<snipped> -fuse-ld=gold'
.However, the environment variables are such that
PATH
is not set and therefore gcc cannot find the gold executable (which is in/usr/bin/gold
). This means I am seeing errors looking like:(
cannot find 'ld'
is just bad error reporting from gcc. It means that gcc cannot findgold
).The only way I found to fix this is to patch rules rust like so:
I was wondering if there was a way to configure the PATH env variable used when running rustc? Possibly I am missing something and this is already doable without patching rules_rust, if so I am sorry!
The text was updated successfully, but these errors were encountered: