Breakage ahead
Breakage ahead
Posted Jan 21, 2020 0:05 UTC (Tue) by mirabilos (subscriber, #84359)Parent article: GNU make 4.3 released
The parallelism thing will also be fun… how to enforce an upper limit, or no parallelism… does -j0 (is that even a thing?) or -j1 (perhaps that instead… how *do* you disable parallelism?) take precedence, at least? Running multiple builds in parallel will need the individual builds to not take up too many CPUs…
Posted Jan 21, 2020 6:06 UTC (Tue)
by madscientist (subscriber, #16861)
[Link] (2 responses)
Yes, -j set on the command line overrides values set in the makefile. -j1 disables parallelism. -j0 is currently an error and not accepted: "make: the '-j' option requires a positive integer argument"
Posted Jan 21, 2020 16:41 UTC (Tue)
by mirabilos (subscriber, #84359)
[Link]
Thanks for the response and information!
Posted Jan 21, 2020 18:24 UTC (Tue)
by josh (subscriber, #17465)
[Link]
Posted Jan 21, 2020 18:31 UTC (Tue)
by josh (subscriber, #17465)
[Link] (5 responses)
If you're running multiple builds in parallel, consider running a jobserver. That would allow limiting the combined CPUs used by all the builds, while allowing a build to use more CPUs while another build is using less.
The jobserver protocol isn't hard to implement manually, even if not using make.
Posted Jan 21, 2020 19:24 UTC (Tue)
by mirabilos (subscriber, #84359)
[Link] (2 responses)
Another example is building stuff on a workstation while using it (with modern GUI apps that use a lot of CPU) at the same time.
Posted Jan 21, 2020 23:48 UTC (Tue)
by madscientist (subscriber, #16861)
[Link] (1 responses)
This is all described in the manual: https://www.gnu.org/software/make/manual/html_node/Parall...
Posted Jan 22, 2020 2:00 UTC (Wed)
by mirabilos (subscriber, #84359)
[Link]
Posted Jan 23, 2020 15:59 UTC (Thu)
by StefanBr (guest, #110916)
[Link] (1 responses)
Unfortunately, the jobserver protocol is broken.
Job tokens are passed down via inherited file descriptors -
Caveat 1: If the called program is not $(MAKE) (verbatim), the file descriptors are closed on exec (FD_CLOEXEC), and the chain ends there. You can opt-in by adding a '+' in front of your command, but then you have to do that on every elegible command. Hint - none of the common Makefile generators does that.
Caveat 2: If you happen to call make indirectly (e.g. via a script called from the Makefile), unfortunately the '--jobserver-auth=<readfd>,<writefd>' will still be in the MAKEFLAGS env var although make had just closed the corresponding file descriptors. Two things can happen:
a) The fds no longer refer to valid file descriptors - make will detect this
Posted Jan 23, 2020 16:16 UTC (Thu)
by mirabilos (subscriber, #84359)
[Link]
Breakage ahead
Breakage ahead
Breakage ahead
Breakage ahead
Breakage ahead
Breakage ahead
Breakage ahead
Breakage ahead
b) The fds have been reused in the meantime - make will find valid file descriptors. If the fd is not readable (e.g. referring to a write end of a pipe), make will start busy looping. If the fd is readable, it will spawn a new job for every byte read (now figure what will happen if it points to a 2 kByte source file ...)
Breakage ahead