-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
rustc should not assume 'cc' is a multiarch linker #9328
Comments
Looks like platform.mk defines some variables in aid of selecting the correct linker.
|
Visiting for triage. platform.mk now defines this: @amatus could you try to reproduce this? I believe this was fixed already but I don't have a way to test it off-hand. |
@flaper87 if you look a bit further down, platform.mk has That value though is only used during the build process. The final |
@luqmana a-ha, thanks for pointing that out. I should've looked better and don't trust the |
I ran into this today, too, although for arm-unknown-linux-gnueabi (without "hf" at the end).
I used to work around this by providing the |
@dcuddeback you can still provide a linker at the command line to Use You can see docs for this and many other codegen options via |
I think we should resolve this issue by changing the error message when linking via |
@pnkfelix Thanks. That worked. I searched around for that last night, but overlooked the "additional help" section at the bottom of the output for |
I ran into this recently as well. In particular, I was trying to use cargo to cross-compile. While cargo has a --target option, which appears to be passed to rustc, it doesn't appear to have any way to pass -C options. In my case, I'm cross-compiling to a different libc, but same architecture. As a result I didn't get any errors, but the resulting executables were linked incorrectly. It would be great if the linker would be fixed for a given target triple (such as a config file or even compiled in to rustc). This would avoid pushing that data into all tools that use rustc (such as cargo). |
Cross compiles now have a linker specified almost all the time (with a prefix), so I don't believe that this is still an issue, so closing. |
I'm still seeing this issue. I've downloaded the .rlib files for rustc from RustBuild to However, linking fails:
Admittedly, |
Just hit precisely this whilst cross compiling - rustbuild is trying to use the host linker/cc to link the final cross binaries rather than the correct cross architechture linker prefix |
…e-extra-deref-from-example, r=giraffate Remove extra dereference from the borrow_deref_ref lint example I don't think such minor change should be mentioned in the changelog. changelog: none
I configured and built rust with the extra target: arm-unknown-linux-gnueabihf. The build process used the correct compiler/linker (arm-linux-gnueabihf-g++) but when trying to build a rust program (with --target arm-unknown-linux-gnueabihf) rustc tries to link by passing -marm to cc and fails because cc is the host compiler and does not know how to link arm objects. Since the configure script has already figured out the correct compiler/linker, it would be nice if the built rustc could also use them.
The text was updated successfully, but these errors were encountered: