-
Notifications
You must be signed in to change notification settings - Fork 502
cross-compiling regression #1469
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
Comments
The problem is that setting I will close this as intended behaviour, you should use one of the following workarounds instead:
|
if is this behaviour documented somewhere other than the build.rs scripts? |
Rethinking a bit, maybe I am wrong here? The old behaviour somewhat matched build.rustflags in Cargo, though that has quite confusing behaviour too (it seems to be dependent on the For a bit more prior art, we have Bazel's WDYT @NobodyXu? Reopening for discussion. |
Let me outline various scenarios, might make it easier to talk about what the desired behaviour is. There are effectively three ways of invoking Cargo:
And
|
Perhaps the desired behaviour would be: let cflags = if cargo_target_flag_is_specified {
if cross_compile {
CFLAGS + CFLAGS_$TARGET
} else {
CFLAGS_HOST + CFLAGS_$TARGET
}
} else {
CFLAGS + CFLAGS_HOST + CFLAGS_$TARGET
}; But I don't think that is implementable with the information that Cargo provides us. |
Hmm so I see that the old behavior is more reasonable for some use cases, so maybe we can introduce |
Is that because We do have code for probing cross compilation cargo_target_flag_is_specified |
Yeah, only Cargo knows whether the
I'd really like to avoid introducing yet another obscure env var. I'd rather revert to the old behaviour if we decide that's how we want it, I'm not too worried about the breakage from that, it's recent enough that I'm fairly sure it's only rustc's bootstrap that relies on it (and I'll fix that before landing any such revert). |
In our (Void Linux's) build system, when cross-compiling, the For various kinds of build systems, we also set: CFLAGS_FOR_BUILD=-O2 -pipe
CFLAGS_target=-O2 -pipe -march=armv8-a
BUILD_CFLAGS=-O2 -pipe
HOST_CFLAGS=-O2
CFLAGS=-fstack-clash-protection -D_FORTIFY_SOURCE=2 -O2 -pipe -march=armv8-a -I/usr/aarch64-linux-gnu/usr/include -ffile-prefix-map=/builddir/sequoia-sq-1.3.1=.
CFLAGS_host=-O2 -pipe but It's probably reasonable to assume that |
When cross-compiling
openssl-sys
fromx86_64-unknown-linux-gnu
toaarch64-unknown-linux-gnu
(and other host/target combinations) withcc
1.2.15 or higher,cc
fails to use the correct compiler, leading to compilation failures because it uses the host's compiler with the target's cflags.By bisecting, I have determined the issue was caused by #1401.
Build log showing failure
The text was updated successfully, but these errors were encountered: