Skip to content
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

Cross lib foundation #25099

Merged
merged 3 commits into from Apr 23, 2017
Merged

Conversation

Ericson2314
Copy link
Member

@Ericson2314 Ericson2314 commented Apr 21, 2017

Motivation for this change

Two innocent native- and cross-hash-preserving change from #25047. It's hard to motivate them on their own (and this is the second sub PR I've made!) but trust me they're needed :). At least they are safe to merge on their own.

[Oh, alright, the first fixes some bugs were we splice together the splice leading packages to bleed past adjacent stages (only adjacent stages are spliced). The second allows compile package hacks where we need to break the rules and depend on something from a future stage because the compiler insists on building the standard library.]

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
    • Linux
  • 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.

@Ericson2314 Ericson2314 added the 6.topic: cross-compilation Building packages on a different sort platform than than they will be run on label Apr 21, 2017
@mention-bot
Copy link

@Ericson2314, thanks for your PR! By analyzing the history of the files in this pull request, we identified @edolstra, @zimbatm and @Profpatsch to be potential reviewers.

@@ -167,6 +167,11 @@
Because of this, a best-of-both-worlds solution is in the works with no splicing or explicit access of <varname>buildPackages</varname> needed.
For now, feel free to use either method.
</para>
<note><para>
There is also a "backlink" <varname>__targetPackages</varname>, yielding a package set which whose <varname>buildPackages</varname> is the current package set.
Copy link
Member

Choose a reason for hiding this comment

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

"which whose" is a little awkward... I'm not sure what to use but I think just using one of those words is enough.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah should just be "whose".

lib/lists.nix Outdated
in
f_0

New in 17.10 --- Until that release is cut, feel free to modify this
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: I think it's 17.09 not 17.10

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks

# defined internally as the produced package set as itself.
#
# THIS IS A HACK for compilers that don't think critically about cross-
# compilation. Please do *not* use unless you really know what you are doing.
Copy link
Member

Choose a reason for hiding this comment

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

Just curious, but what compilers need __targetPackages? It looks like from your other commits that it is only used by glibc?

Copy link
Member Author

Choose a reason for hiding this comment

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

GHC, certain GCC stages as exists, cc-wrapper with libc.

lib/lists.nix Outdated
New in 17.10 --- Until that release is cut, feel free to modify this
function (and update its uses accordingly).
*/
dfold = op: lnul: rnul: list:
Copy link
Member

Choose a reason for hiding this comment

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

I’m really not sure this is general enough to be in the base library. The use-cases seem very limited.

Copy link
Member Author

Choose a reason for hiding this comment

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

Moved out of lib and into booter.nix for now.

@@ -87,6 +94,8 @@ let
stdenvBootstappingAndPlatforms = self: super: {
buildPackages = (if buildPackages == null then self else buildPackages)
// { recurseForDerivations = false; };
__targetPackages = (if __targetPackages == null then self else __targetPackages)
Copy link
Member

Choose a reason for hiding this comment

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

Using null here seems kind of forced—what’s the difference to []?

Copy link
Member Author

Choose a reason for hiding this comment

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

Err it would normally be an attribute set. I wanted to distinguish { .. } --- the target package set is different and contains these packages , from null -- the target package set is the same as the regular package set. This allows me to avoid splicing, which is expensive.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

I fixed wording

@Ericson2314 Ericson2314 force-pushed the cross-lib-foundation branch 3 times, most recently from 12f02e7 to fad54d8 Compare April 23, 2017 17:31
 - `pkgs` is self-similar, and thus already spliced
 - `buildPackages` is an ingredient of splicing and should be kept as is
 - The platforms are not packages or package sets and couldn't be spliced

There's probably other things that shouldn't be spliced too. The best long-
term solution is simply to stop splicing altogether.
Each bootstrapping stage ought to just depend on the previous stage, but
poorly-written compilers break this elegence. This provides an easy-enough
way to depend on the next stage: targetPackages. PLEASE DO NOT USE IT
UNLESS YOU MUST!

I'm hoping someday in a pleasant future I can revert this commit :)
@Ericson2314 Ericson2314 dismissed Profpatsch’s stale review April 23, 2017 18:03

Moved dfold out of lib and clarified answer to question in code

@Ericson2314 Ericson2314 merged commit b59fdc4 into NixOS:master Apr 23, 2017
@Ericson2314 Ericson2314 deleted the cross-lib-foundation branch April 23, 2017 18:12
@Ericson2314 Ericson2314 added this to Prior in Cross compilation Oct 30, 2017
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 sort platform than than they will be run on
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants