-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Cargo uses different linker for some dependencies #4741
Comments
Additionally, the linker arguments seem to be inappropriate. They include |
When cross-compiling dependencies are compiled differently as some are needed for build scripts (on the host) and others are needed for the target. Can you gist the full error message you're seeing? |
Oops, sorry, I attached the error for a native build previously. Here's the output: |
Okay, it seems that I'm now getting an error that seems specific to So, this no longer seems like a Cargo issue but something related to |
The error in the gist you sent was a missing |
@alexcrichton Sorry, I would completely ignore the gist. Uninstalling my Debian gcc-7 cross-compiling packages and installing gcc-6 ones (which match the system native gcc version) seemed to fix that issue. I'm not sure why Cargo ever went looking for a compiler with the generic name Anyway, yes, after getting a working |
Note that compiler/linker selection isn't always automatic and can sometimes require some amount of configuration. For example The bug in configuration could be anywhere there along the chain unfortunately :( |
I showed my |
I think that may have been through the |
@alexcrichton Makes sense. Any idea why I'd like to see if I can verify that indeed this is a Failing that, do you think |
@BatmanAoD oh they're just different systems. Cargo actually isn't doing anything and it's Can you gist the current error message? If it's in a build script it's |
Sorry, what I mean is, why wouldn't Here's the error in the console: ..and here's Note line 72:
|
OK that error is from the |
Correct. Since I'm feeding |
I think this is just rust-lang/cc-rs#82? Cargo doesn't currently set anything for |
@alexcrichton Yes! I hadn't seen that issue. I'm not sure I entirely understand the rational for not just making Cargo communicate the proper toolchain to Perhaps if the user specifies a linker that actually is a full C compiler, then Cargo should export the associated environment variables? As for this particular failure of |
Oh it's just a thing to design and implement. It's also got a lot of options of how it's implemented. Consequently, it requires a fairly nontrivial effort to do, so it just hasn't been done! There's of course no reason Cargo couldn't do this, it's just that no one's gotten around to it yet. Also yeah seems plausible for cc to handle this by default! |
@alexcrichton Okay; some of the comments from those issues made me think that maybe you were opposed to having communication (direct or indirect) from Cargo to |
Ah no sorry, was just trying to clarify what was going on! |
I believe Cargo here is working correctly, so I'm going to close this in favor of rust-lang/cc-rs#82 |
Description
It appears that I can't cross-compile some dependencies, because Cargo attempts to use
cc
as the linker for these packages despite my specification of a target-specific linker. None of my installed linkers are called simplycc
, so this of course fails.The specific packages I've encountered problems with so far are:
error-chain
(fails compilingbacktrace_sys
)serde_derive
zmq
(fails compilingzmq-sys
)I looked at the
Cargo.toml
forserde_derive
and also ripgrep'd the source for instances ofcc
and found nothing; since this is happening with multiple packages and I don't know why it would ever make sense to revert to some kind of generic linker when cross-compiling, I believe this is an issue with Cargo. (Not necessarily a bug; I fully realize that I could simply be doing something wrong!)My setup
I'm on a Debian system and have installed the linker
arm-linux-gnueabihf-gcc-7
.My
~/.cargo/config
:To trigger the bug, I put this in my
Cargo.toml
for a simple "hello world" app:I then built with:
My cargo version
The text was updated successfully, but these errors were encountered: