See: https://www.gnu.org/software/coreutils/manual/html_node/nproc-invocation.html
Revival of a failed attempt in #30619
You can test on your mac via:
0% echo $(nproc)
1command not found: nproc
0% brew install coreutils
1...
2% echo $(nproc)
310
nproc
support for Mac through coreutils
#30936
See: https://www.gnu.org/software/coreutils/manual/html_node/nproc-invocation.html
Revival of a failed attempt in #30619
You can test on your mac via:
0% echo $(nproc)
1command not found: nproc
0% brew install coreutils
1...
2% echo $(nproc)
310
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/30936.
See the guideline for information on the review process. A summary of reviews will appear here.
No conflicts as of last run.
# Use "-j N" here for N parallel jobs.
doesn’t seem too useful for most users, assuming that devs already have it installed anyway (or an alternative).
-j N
docs, since people are migrating to Ninja anyway?
This stupid nproc
problem comes up often for macs, was hoping we can finally get rid of it…
In every other doc we're using $(nproc)
See: https://www.gnu.org/software/coreutils/manual/html_node/nproc-invocation.html
Don’t agree with having this in the build doc, no need to have a user install such a package that is not needed to build bitcoin. Docs should only have users install required dependencies. If it really helps, productivity notes could point a user as to how they can have nproc
support.
A mac user can also just alias nproc="sysctl -n hw.logicalcpu"
, no need for us to be opinionated on installing a dependency for this in this doc.
A mac user can also just alias nproc=“sysctl -n hw.logicalcpu”
Absolutely, but let’s document these somewhere, since we’re using -j$(nproc)
in a few other places in the code, without mentioning that Mac users will need to do a few extra steps
@l0rinc sure, but this nproc thing on macOS isn’t necessarily something we have to document, its not like its new or unique to our project in a way, and docs are written in a way where we expect the user to know a bit about their OS already. I would assume most people who build bitcoin on macOS are already used to the in-and-outs of building on macOS.
In any case, i agree it can be in productivity if it proves to be helpful to builders.
222@@ -223,10 +223,13 @@ After configuration, you are ready to compile.
223 Run the following in your terminal to compile Bitcoin Core:
224
225 ``` bash
226-cmake --build build # Use "-j N" here for N parallel jobs.
227-ctest --test-dir build # Use "-j N" for N parallel tests. Some tests are disabled if Python 3 is not available.
228+cmake --build build -j$(nproc)
-G ninja
, the ninja build system uses all available CPU threads by default 😎
(not sure we’d want to recommend it as default tho)