Repository navigation
Passing -j32 for ninja no longer works #53176
Description
Activity
- changed the title
[-]Passing ninja job no longer works[/-][+]Passing `-j32` for ninja no longer works[/+]on May 27, 2024 @anonrig @jakecastelli This
Dockerfiledemonstrates that passing-jfrommaketoninjaworks on Ubuntu on the main branch:FROM ubuntu:latest RUN apt-get update && apt-get install -y git build-essential ninja-build python3 WORKDIR /nodejs RUN git clone --depth=1 https://github.com/nodejs/node.git WORKDIR /nodejs/node RUN ./configure --ninja RUN make -j3
$ docker build --progress=plain . ... #10 [7/7] RUN make -j3 #10 0.519 ninja -C out/Release -j3 #10 0.521 ninja: Entering directory `out/Release'
Reacted by jakecastelliI'm on macOS and it doesn't work:
$ make -v GNU Make 3.81 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This program built for i386-apple-darwin11.3.0- addedbuildIssues and PRs related to Node.js builds or CI infrastructure.Issues and PRs related to Node.js builds or CI infrastructure.macosIssues and PRs related to the macOS platform.Issues and PRs related to the macOS platform.
on May 28, 2024 I am on MacOS as well, exactly the same GNU Make as yours @targos - the current work around for me is to use
make JOBS=nOn Linux, it seems that GNU Make 3.81 was obsolete in 2010 and last distributed in Ubuntu 14 — a decade ago... is that the most recent official release for macOS?
I found this StackOverflow thread that seems related, and which is also about macOS. It also mentions differences in how
MAKEFLAGSis passed between make 3.x and 4.x.The default
makeversion available on macOS probably won't change in the near future, but it's possible to install the latest using homebrew: https://formulae.brew.sh/formula/make#defaultI upgraded my make to
v4.4.1and I can verify it works on main (-jn can be properly propagated).$ make -v GNU Make 4.4.1 Built for aarch64-apple-darwin22.3.0 Copyright (C) 1988-2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.I think your fix 19f0bca is legit! @tniessen we might need to update the README for mac users.
Reacted by Tobias NießenI think in conclusion for mac users there are two options:
- use
make JOBS=ninstead ofmake -jnif you are using the macOS defaultmake. - upgrade
maketov4.xthroughhomebrewand runmake -jn.
Are you guys happy for me to update the
BUILDING.mdin a separate PR?- use
@jakecastelli Thank you so much for confirming! Let me try to add a workaround for ancient versions of GNU make to our Makefile.
@targos Since you have access to macOS and are still using GNU Make 3.81, could you please test if this patch fixes the propagation?
diff --git a/Makefile b/Makefile index 5187d6a950..8f579bada1 100644 --- a/Makefile +++ b/Makefile @@ -147,7 +147,11 @@ ifdef JOBS NINJA_ARGS := $(NINJA_ARGS) -j$(JOBS) else IMMEDIATE_NINJA_ARGS := $(NINJA_ARGS) - NINJA_ARGS = $(IMMEDIATE_NINJA_ARGS) $(filter -j%,$(MAKEFLAGS)) + ifneq (3.81,$(MAKE_VERSION)) + NINJA_ARGS = $(IMMEDIATE_NINJA_ARGS) $(filter -j%,$(MAKEFLAGS)) + else + NINJA_ARGS := $(IMMEDIATE_NINJA_ARGS) $(filter -j%,$(MAKEFLAGS)) + endif endif $(NODE_EXE): config.gypi out/Release/build.ninja $(NINJA) -C out/Release $(NINJA_ARGS)
If it does, I can open a PR and add an explanation to the
Makefile.I notice one change of behavior with make v4. When configuring with
--debug, it now runs theninjacommands for both Release and Debug builds in parallel (with v3, it was in sequence):$ make -j6 ninja -C out/Release -j6 ninja -C out/Debug -j6 ninja: Entering directory `out/Release' ninja: Entering directory `out/Debug'Reacted by jakecastelli@tniessen I wouldn't say it fixes the propagation, but at least it goes back to the previous "working" behavior that doesn't propagate the
-jflag.If I remember correctly with make v3 it builds the release and then the debug build separately right?
edit: sorry you have already mentioned here
with v3, it was in sequence
11 remaining items
Would you like to add a note to building-node-with-ninja.md about this issue with ancient make versions?
Sure, I can do that 👍
- added a commit that references this issue
on May 30, 2024 - added a commit that references this issue
on Jun 1, 2024 - added a commit that references this issue
on Jun 8, 2024 - added a commit that references this issue
on Jun 20, 2024 - added 2 commits that reference this issue
on Jun 20, 2024 - added a commit that references this issue
on Mar 30, 2026
Running
./configure --ninja -Cand later running-make -j32no longer works on main.Possibly related to. 19f0bca
cc @tniessen