Commit Graph

15 Commits

Author SHA1 Message Date
Anderson Torres
a5a1d526d0
Merge pull request #189773 from AndersonTorres/ninja
Ninja: reformat expression
2022-09-24 21:50:21 -03:00
Graham Christensen
c2b898da76 treewide: drop -l$NIX_BUILD_CORES
Passing `-l$NIX_BUILD_CORES` improperly limits the overall system load.

For a build machine which is configured to run `$B` builds where each
build gets `total cores / B` cores (`$C`), passing `-l $C` to make will
improperly limit the load to `$C` instead of `$B * $C`.

This effect becomes quite pronounced on machines with 80 cores, with
40 simultaneous builds and a cores limit of 2. On a machine with this
configuration, Nix will run 40 builds and make will limit the overall
system load to approximately 2. A build machine with this many cores
can happily run with a load approaching 80.

A non-solution is to oversubscribe the machine, by picking a larger
`$C`. However, there is no way to divide the number of cores in a way
which fairly subdivides the available cores when `$B` is greater than
1.

There has been exploration of passing a jobserver in to the sandbox,
or sharing a jobserver between all the builds. This is one option, but
relatively complicated and only supports make. Lots of other software
uses its own implementation of `-j` and doesn't support either `-l` or
the Make jobserver.

For the case of an interactive user machine, the user should limit
overall system load using `$B`, `$C`, and optionally systemd's
cpu/network/io limiting features.

Making this change should significantly improve the utilization of our
build farm, and improve the throughput of Hydra.
2022-09-22 16:01:23 -04:00
AndersonTorres
e0aa46d57b ninja: reorder setup-hook.sh
It is considerably more readable to put the functions-hooks before the code
activating them.
2022-09-16 00:39:10 -03:00
milahu
20f3160f41 ninja: disable line-clearing with TERM=dumb 2022-06-25 17:08:53 +02:00
pennae
2f2fa58e4d ninja: pipe ninja output through cat in hooks
ninja build progress output is not line-base, it overwrites the same
line over and over again with its progress reporting. nix is line-based
though, so ninja-based builds have their progress hidden. pipe ninja
output through cat to avoid this.
2021-12-09 09:43:36 +01:00
John Ericson
b7f4bda282 treewide: *Phase(s)? variables are optional
If these aren't defined, the stdenv defaults are used in the `*Phase`
case, or no extra phases are done, in the `*Phases` case.
2019-11-01 14:44:44 -04:00
John Ericson
1290e532ea treewide: Make more dont* variables OK to be undefined in setup hooks 2019-11-01 14:44:44 -04:00
Matthew Bauer
285eb9a894 cmake: set CTEST_OUTPUT_ON_FAILURE globally
We should always use this.
2018-11-19 16:16:16 -06:00
Matthew Bauer
b75d5adb33 ninja: restore old -l flag value
This can be set unconditionally to $NIX_BUILD_CORES according to
@orivej.
2018-11-18 19:31:03 -06:00
Matthew Bauer
a16c04c9d3 ninja: don’t use build/install/check flags in setup-hook
These don’t have much use in ninja, so easiest to leave them out.
2018-11-18 19:31:02 -06:00
Matthew Bauer
4ebab3de1e ninja: use -t query to find test target 2018-11-18 19:31:02 -06:00
Matthew Bauer
9433a3882b ninja: fix mistake in setup-hook 2018-11-18 19:31:01 -06:00
Matthew Bauer
69d1151bfa ninja: make setup-hook.sh closer to setup.sh
Things changed in the Ninja setup-hook:
- Respect installFlags
- Automatically add checkPhase (can be disabled with dontUseNinjaCheck
  in the same way as dontUseNinjaBuild and dontUseNinjaInstall). Tests
  are only run when "ninja test" exists.
- Error in build phase when build.ninja is missing. We don’t have a
  way to fall back to other build methods, so it’s best to be very
  clear when we aren’t able to build with ninja
- Set -l flag to 1 when enableParallelBuilding is disabled
2018-11-18 19:31:01 -06:00
Orivej Desh
2c7cd2455e ninja: support disabling parallel building
but keep it enabled by default
2017-12-07 08:52:42 +00:00
Lukas Werling
f0a1ab78b4 meson/ninja: add setup hooks (#28444)
* Add setupHook for meson/ninja build

* libhttpseverywhere: Use meson/ninja setupHooks

* jamomacore: Remove superfluous ninja buildInput

* Remove obsolete ninja buildPhases

These are all handled by ninja's setup hook.

* lean2, xcbuild: fix build with ninja setup hook

Ninja is a runtime dependency here. However, cmake can generate Ninja
build files as well to satisfy the setup hook.

* qtwebengine: fix build with ninja setup hook
2017-08-27 19:42:21 +02:00