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:
% echo $(nproc)
command not found: nproc
% brew install coreutils
...
% echo $(nproc)
10
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:
% echo $(nproc)
command not found: nproc
% brew install coreutils
...
% echo $(nproc)
10
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--006a51241073e994b41acfe9ec718e94-->
For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/30936.
<!--021abf342d371248e50ceaed478a90ca-->
See the guideline for information on the review process. A summary of reviews will appear here.
<!--174a7506f384e20aa4161008e828411d-->
No conflicts as of last run.
Concept nack. This is something a user can do on their own system if they want to use nproc generally. However it's not a requirement for building bitcoind.
No objection to adding this, but just installing it and then leaving the docs in this file as # 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).
I think the only place this might make sense would be in the developer documentation. I don't think we should be adding additional things as base dependencies for os specific instructions, just so someone can call a utility. It's also less relevant, given devs may already be using generators that are handling this by default, i.e Ninja.
Thanks for the comments, would it make sense to add this to the mac developer notes instead, or should we remove the -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
Updated, as I think this can be useful. Once the docs transition to Ninja, we can of course remove these manual steps.
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)
Could also use -G ninja, the ninja build system uses all available CPU threads by default 😎
(not sure we'd want to recommend it as default tho)