Skip to content

treewide: Remove crossConfig and add strictDeps - #40529

Merged
Ericson2314 merged 3 commits into
NixOS:stagingfrom
obsidiansystems:strictDeps
May 15, 2018
Merged

Ericson2314 merged 3 commits into
NixOS:stagingfrom
obsidiansystems:strictDeps

Conversation

@Ericson2314

@Ericson2314 Ericson2314 commented May 15, 2018 •

Copy link
Copy Markdown
Member
Motivation for this change

Fix #40531

One exception to the crossConfig usage being old I did in 469fd89, using it control how flexible/rigid our handling of dependencies is. Instead of punning on crossConfig, we add a strictDeps which is by default just true for hostPlatform != buildPlatform. This means in packages that always need strict deps, we can do strictDeps = true instead of the far more confusing crossConfig = true.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

CC @srhb @TravisWhitaker

@Ericson2314 Ericson2314 added the 6.topic: cross-compilation Building packages on a different platform than they will be used on label May 15, 2018
@Ericson2314 Ericson2314 added this to the 18.09 milestone May 15, 2018
@Ericson2314
Ericson2314 requested review from orivej and peti as code owners May 15, 2018 00:21
@GrahamcOfBorg GrahamcOfBorg added 6.topic: haskell General-purpose, statically typed, purely functional programming language 6.topic: stdenv Standard environment 2.status: merge conflict This PR has merge conflicts with the target branch labels May 15, 2018
@GrahamcOfBorg GrahamcOfBorg removed the 2.status: merge conflict This PR has merge conflicts with the target branch label May 15, 2018
@Ericson2314
Ericson2314 requested a review from srhb May 15, 2018 03:10
The hack of using `crossConfig` to enforce stricter handling of
dependencies is replaced with a dedicated `strictDeps` for that purpose.
(Experience has shown that my punning was a terrible idea that made more
difficult and embarrising to teach teach.)

Now that is is clear, a few packages now use `strictDeps`, to fix
various bugs:

 - bintools-wrapper and cc-wrapper
All its uses have been removed.
@GrahamcOfBorg GrahamcOfBorg added 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-linux-stdenv This PR causes stdenv to rebuild on Linux and must target a staging branch. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. labels May 15, 2018
@Ericson2314
Ericson2314 merged commit 71bbe83 into NixOS:staging May 15, 2018
@Ericson2314
Ericson2314 deleted the strictDeps branch May 15, 2018 03:49
@srhb

srhb commented May 15, 2018

Copy link
Copy Markdown
Contributor

A bit late to the show. I'm obviously happy with this, though I don't find the name strictDeps particularly more enlightening than crossConfig was. What's strict about them? :D

cmakeFlags="-DCMAKE_CXX_COMPILER=$CXX $cmakeFlags"
cmakeFlags="-DCMAKE_C_COMPILER=$CC $cmakeFlags"
cmakeFlags="-DCMAKE_AR=$(command -v $AR) $cmakeFlags"
cmakeFlags="-DCMAKE_RANLIB=$(command -v $RANLAB) $cmakeFlags"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo.

Also these are now being set in native builds which doesn't seem very desirable.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks you for the catch.

, doInstallCheck ? config.doCheckByDefault or false

, crossConfig ? null
, # TODO(@Ericson2314): Make always true and remove

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no business having these sorts of TODO comments until it's accepted (via an RFC) that it will be done.

userHook = config.stdenv.userHook or null;
__ignoreNulls = true;

inherit strictDeps;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bloats every derivation with a yet another extra field and makes mkDerivation slower. This is explicitly discouraged.

@Ericson2314

Copy link
Copy Markdown
Member Author

@LnL7 hmm I thought cmake stuff ignored extra -D sorry.

@Ericson2314

Ericson2314 commented May 15, 2018 •

Copy link
Copy Markdown
Member Author

Preliminarily fixed both CMake problems and building Darwin stdenv right now.

This was referenced May 15, 2018
@Ericson2314

Copy link
Copy Markdown
Member Author

@srhb well, saner name doesn't get me out of the obligation of actually documenting this in the manual!

@dtzWill

dtzWill commented May 16, 2018

Copy link
Copy Markdown
Member

Haha oops sorry re:revert on my random branch O:). Already dropped it on that branch, but the mention lives on! Silly github.

@Ericson2314

Ericson2314 commented May 16, 2018 •

Copy link
Copy Markdown
Member Author

@dtzWill Ah no worries. I see that it was your own branch from the get go. And, FWIW since I did break staging, anyone would have full right to revert this PR on it too per the official policy, IIRC. So I couldn't complain in that case either :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: cross-compilation Building packages on a different platform than they will be used on 6.topic: haskell General-purpose, statically typed, purely functional programming language 6.topic: stdenv Standard environment 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux-stdenv This PR causes stdenv to rebuild on Linux and must target a staging branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants