doc: Add nproc support for Mac through coreutils #30936

pull l0rinc wants to merge 2 commits into bitcoin:master from l0rinc:l0rinc/nproc-mac changing 2 files +9 −3
  1. l0rinc commented at 9:44 am on September 20, 2024: contributor

    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
    
  2. DrahtBot commented at 9:44 am on September 20, 2024: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/30936.

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

    Conflicts

    No conflicts as of last run.

  3. DrahtBot added the label Docs on Sep 20, 2024
  4. fanquake commented at 9:53 am on September 20, 2024: member
    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.
  5. maflcko commented at 10:06 am on September 20, 2024: member
    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).
  6. fanquake commented at 10:10 am on September 20, 2024: member
    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.
  7. l0rinc commented at 10:21 am on September 20, 2024: contributor
    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…
  8. doc: simplify nproc+1 to nproc
    In every other doc we're using $(nproc)
    de919ed103
  9. doc: Add nproc support for mac through coreutils
    See: https://www.gnu.org/software/coreutils/manual/html_node/nproc-invocation.html
    76cc6054a1
  10. l0rinc force-pushed on Sep 21, 2024
  11. l0rinc commented at 3:41 pm on September 21, 2024: contributor
    Updated, as I think this can be useful. Once the docs transition to Ninja, we can of course remove these manual steps.
  12. jarolrod commented at 8:19 pm on September 25, 2024: member

    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.

  13. l0rinc commented at 8:26 pm on September 25, 2024: contributor

    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

  14. jarolrod commented at 8:36 pm on September 25, 2024: member

    @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.

  15. in doc/build-osx.md:226 in 76cc6054a1
    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)
    


    laanwj commented at 8:24 am on October 20, 2024:
    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)
  16. PoundsCP approved

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-22 21:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me