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
stdenv: Force doCheck
to be false when we are cross compiling
#33603
Conversation
70951e5
to
dac8879
Compare
fcc0447
to
047df9e
Compare
Thanks! Generally LGTM! Few notes: Could you add a note documenting this behavior? Especially important since the behavior won't be what one expects from looking at the expression. Actually, on that: Also: probably should extend this to cover the installcheck phase (doInstallCheck) as well? Finally, we don't need it yet AFAIK but while brainstorming on it it may make sense to add a doCrossCheck or dontDisableCheckOnCross to override. Don't see any reason to add it until it's needed, though. |
Sounds good to me. Also fully agree with @dtzWill's comments. |
@@ -62,7 +62,7 @@ stdenv.mkDerivation rec { | |||
# Darwin (http://thread.gmane.org/gmane.comp.gnu.core-utils.bugs/19351), | |||
# and {Open,Free}BSD. | |||
# With non-standard storeDir: https://github.com/NixOS/nix/issues/512 | |||
doCheck = hostPlatform == buildPlatform | |||
doCheck = true; # not cross | |||
&& hostPlatform.libc == "glibc" | |||
&& builtins.storeDir == "/nix/store"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bad syntax
Probably can't so warning very well until mass rebuild, unless we do an eval time warning, but getting to the rest. |
1c2cfa5
to
178ca91
Compare
…cross compiling I hope this will be a temporary measure. If there is consensus around issue NixOS#33599, then we can follow an explicit `dontCheck`, but default to not checking during cross builds when none is given.
In anticipation of what I outline in NixOS#33599, I only simplify exactly those `doCheck`s which are equal to `hostPlatform != buildPlatform`. I also stick a comment next to them so I can grep for them later.
178ca91
to
133b465
Compare
How does this look now? |
Great! Bummer can't log without forcing a mass-rebuild :(. I think the warning is absolutely worth the rebuild--although I'm happy if we tackle it separately and target staging with it or something (and not block this PR on it). Do you know how such a warning might best be implemented? I suppose if it's too much trouble re:complicating unrelated things, we don't "need" the warning. Would be nice though :). Also, TIL:
And less surprisingly:
Neat! |
I love how this apparently causes "no" rebuilds?! (at least according to the |
@dtzWill yeah something in setup.sh, pretty sure. |
Hmm, should this be comparing buildPlatform instead of targetPlatform? |
@dtzWill haha got me! Indeed it should. |
Would it be reasonable to add a trapdoor so one can still use a checkPhase when cross-compiling? Currently there's no way to check cross-compiled packages - you have to put the check in some other phase because doCheck is impossible to enable. I think there should be an "I know what I'm doing" flag so one can write an idiomatic check phase, which will at least run some cross-friendly sanity checks. |
Sorry for commenting on old pr, but I agree with @r-burns, forcing doCheck can be useful in controlled environments like CI, where for example x86_64 system can run a x86 binary. |
Motivation for this change
This restores in effect what the old
gcc-cross-wrapper
did.I hope this will be a temporary measure. If there is consensus around issue #33599, then we can follow an explicit
dontCheck
, but default to not checking during cross builds when none is given.In anticipation of what I outline in #33599, I only simplify exactly those
doCheck
s which are equal tohostPlatform != buildPlatform
. I also stick a comment next to them so I can grep for them later.Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)CC @dezgeg @bgamari @dtzWill