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

lib: Fix #30902 #34444

Merged
merged 3 commits into from
Mar 18, 2018
Merged

lib: Fix #30902 #34444

merged 3 commits into from
Mar 18, 2018

Conversation

Ericson2314
Copy link
Member

@Ericson2314 Ericson2314 commented Jan 31, 2018

Motivation for this change

See the "lib, stdenv: Check..." commit for details.

Work in progress because I need to overhaul release-lib.nix, and maybe other uses of meta.platforms.

Fixes #30902

Things done

Need to ensure release-lib.nix packages still eval fine.

  • 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 @bgamari @dtzWill

@Ericson2314 Ericson2314 added 2.status: work-in-progress This PR isn't done 6.topic: cross-compilation Building packages on a different platform than they will be used on labels Jan 31, 2018
@Ericson2314 Ericson2314 force-pushed the meta-check branch 2 times, most recently from d0de3fa to 3573805 Compare January 31, 2018 23:01
@Ericson2314 Ericson2314 removed the 2.status: work-in-progress This PR isn't done label Feb 5, 2018
@grahamc
Copy link
Member

grahamc commented Feb 5, 2018

@GrahamcOfBorg eval

@Ericson2314
Copy link
Member Author

Ericson2314 commented Feb 6, 2018

@dtzWill lets land this first. Frankly, I'm not sure how you made it so far without it :).

@dtzWill
Copy link
Member

dtzWill commented Feb 6, 2018

Haha, not sure! Will take a look shortly.

@Ericson2314
Copy link
Member Author

I can eval everything locally, but it kills @GrahamcOfBorg so not sure what that's about. I hope its not just me making everything more expensive.

@Ericson2314
Copy link
Member Author

The message is from Boehm GC, to be clear.

@dtzWill
Copy link
Member

dtzWill commented Feb 7, 2018

I could be wrong but I think evaluating all of nixpkgs is beyond our Borg friend's limits currently.

Large hydra evaluations specifically strip out a bunch of stuff to reduce memory, so it's not without precedent to find evaluating all the things a large task :).

That said, it may be worth quickly testing time/memory of a large evaluation before and after this change -- regressing too badly on this will negatively impact almost everyone and probably summon an angry mob. But just be sure this doesn't 2x evaluation time or something :P.

Borg may want to use a larger heap, which I think is the usual way to workaround that error. I forget the environment variable name O:).

Not sure where previous discussion of this ended up, for example: #33747 (comment)

Ideally of course we'd be constantly making evaluation faster using less memory :D.

@grahamc
Copy link
Member

grahamc commented Feb 7, 2018

I think evaluating all of nixpkgs is beyond our Borg friend's limits currently.

OfBorg's evaluators have 16G of RAM.

it may be worth quickly testing time/memory of a large evaluation before and after this change -- regressing too badly on this will negatively impact almost everyone and probably summon an angry mob.

Agreed :)

Especially on:

just be sure this doesn't 2x evaluation time or something :P

Borg may want to use a larger heap, which I think is the usual way to workaround that error. I forget the environment variable name O:).

I think we want GC_MAXIMUM_HEAP_SIZE but I'm not sure what to set it to. I think this eval error is reproducible outside of borg using the outpaths.nix https://github.com/NixOS/ofborg/blob/released/ofborg/src/outpaths.nix Basically:

cp ../ofborg/ofborg/src/outpaths.nix .; nix-env -f ./outpaths.nix -qaP --no-name --out-path --arg checkMeta true > outs

Can someone do a bit of trial and error on that? I can set the variable on the evaluators.

@grahamc
Copy link
Member

grahamc commented Feb 7, 2018

@GrahamcOfBorg eval

also this ^ I'll keep tabs on the eval in my monitoring.

@dtzWill
Copy link
Member

dtzWill commented Feb 7, 2018

I forget if it helped but I'll just note that we do use a boehmgc that is /not/ tuned for "large" heaps where IIRC "large" is definitely smaller than what we use on most evals.

https://github.com/ivmai/bdwgc/blob/b5cab5aacd263577af3502ecf068612591d27704/configure.ac#L840
https://github.com/ivmai/bdwgc/blob/master/doc/README.macros

Err nevermind this, until I look into it more (or someone else does), just wanted to mention while on the subject.

@grahamc
Copy link
Member

grahamc commented Feb 7, 2018

This PR doesn't seem to have a substantial impact ... but I only looked at four evals in some fairly lousy data.

@dtzWill
Copy link
Member

dtzWill commented Feb 7, 2018

Note it complains of hitting limit re:heap sections, which appears to be ~8GB:
https://github.com/ivmai/bdwgc/blob/master/include/private/gc_priv.h#L1194 .

It "may" make sense to consider building against a boehmgc with large config enabled.
edit: noping :(.

@grahamc
Copy link
Member

grahamc commented Feb 7, 2018

@dtzWill before pinging Eelco, can you try it and see if it makes an improvement? :)

@dtzWill
Copy link
Member

dtzWill commented Feb 7, 2018

@dtzWill before pinging Eelco, can you try it and see if it makes an improvement?

Sure. But since he introduced the enableLargeConfig option (8e2e421) it seemed likely he had existing knowledge/experience/opinions/insights on the subject before investigating myself. Anyway, point taken I'll drop it until I have evidence it helps :).

@grahamc
Copy link
Member

grahamc commented Feb 8, 2018

It seems master went over the line, so we must have been mighty close:

@GrahamcOfBorg eval

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Partial log (click to expand)

/nix/store/bwl4ml2xvfjhfm2f0fr1yy4pllclpd2j-stdenv

… world

First, we need check against the host platform, not the build platform.
That's simple enough.

Second, we move away from exahustive finite case analysis (i.e.
exhaustively listing all platforms the package builds on). That only
work in a closed-world setting, where we know all platforms we might
build one. But with cross compilation, we may be building for arbitrary
platforms, So we need fancier filters. This is the closed world to open
world change.

The solution is instead of having a list of systems (strings in the form
"foo-bar"), we have a list of of systems or "patterns", i.e. attributes
that partially match the output of the parsers in `lib.systems.parse`.
The "check meta" logic treats the systems strings as an exact whitelist
just as before, but treats the patterns as a fuzzy whitelist,
intersecting the actual `hostPlatform` with the pattern and then
checking for equality. (This is done using `matchAttrs`).

The default convenience lists for `meta.platforms` are now changed to be
lists of patterns (usually a single pattern) in
`lib/systems/for-meta.nix` for maximum flexibility under this new
system.

Fixes NixOS#30902
`packagePlatforms` now filters `supportedSystems` with the new-style
`meta.platforms`, rather than just plopping it in as is.
@GrahamcOfBorg GrahamcOfBorg added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild 10.rebuild-linux: 0 This PR does not cause any packages to rebuild and removed 10.rebuild-darwin: 11-100 10.rebuild-linux: 1-10 labels Mar 15, 2018
@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: stdenv

Partial log (click to expand)

/nix/store/l3nz0167a4xhb78ldcjns5p4dwvlm1cw-stdenv

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: stdenv

Partial log (click to expand)

/nix/store/rvpmm1jmqi7j1w3a073511plvlbl4fw7-stdenv

@Ericson2314
Copy link
Member Author

Ok, pre-fixed all the misbehaving packages so this is ready for final review! No more rebuilds anymore.

@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: stdenv

Partial log (click to expand)

/nix/store/0igxxngigjgfkgg3cw547n92b8bpg6b1-stdenv-darwin

@Ericson2314
Copy link
Member Author

I need to do a PR on top of this, so I'm going to merge it. Feel free to revert if eval time problems arise, but this should be good in all other respects.

@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: stdenv

Partial log (click to expand)

/nix/store/w3k60lgxbkj1sj1zpyh50671qpky0v1w-stdenv-darwin

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: stdenv

Partial log (click to expand)

/nix/store/yq16vcdl95kfqjzq23lxhin38i3whlyj-stdenv-linux

@Ericson2314 Ericson2314 merged commit 2fa2197 into NixOS:master Mar 18, 2018
@Ericson2314 Ericson2314 deleted the meta-check branch March 18, 2018 17:51
@Ericson2314 Ericson2314 mentioned this pull request Mar 18, 2018
8 tasks
@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: stdenv

Partial log (click to expand)

/nix/store/6kz2vbh98s2r1pfshidkzhiy2s2qdw0a-stdenv-linux

@orivej
Copy link
Contributor

orivej commented Sep 25, 2018

@Ericson2314 Could you help updating this platforms line in boost: https://github.com/NixOS/nixpkgs/blob/18.03/pkgs/development/libraries/boost/generic.nix#L92? Currently Hydra attempts to build boost155 for Aarch64 and fails.

@Ericson2314
Copy link
Member Author

One can fall back on the legacy stuff by using https://github.com/NixOS/nixpkgs/blob/master/lib/systems/doubles.nix#L45 . I think that's easiest for now.

@orivej
Copy link
Contributor

orivej commented Sep 25, 2018

Thank you! We can replace platforms.unix with systems.doubles.unix on that line to fix it. However, may we express it in a non-legacy way?

@Ericson2314
Copy link
Member Author

Yeah. The new ones are https://github.com/NixOS/nixpkgs/blob/master/lib/systems/for-meta.nix made from https://github.com/NixOS/nixpkgs/blob/master/lib/systems/inspect.nix . There's still no negation but if you combine the x86 pattern with all the unix ones, you can get isx86 && isUnix.

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 8.has: clean-up 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild 10.rebuild-linux: 0 This PR does not cause any packages to rebuild
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants