depends: Use base system’s sha256sum utility on FreeBSD #31626

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:250109-sha256sum changing 1 files +1 −1
  1. hebasto commented at 12:22 pm on January 9, 2025: member

    On FreeBSD, the shasum utility is provided by the perl5 port, which is not part of the base system and must be installed separately. Note that this requirement is currently not documented in depends/README.md.

    This PR switches to using the sha256sum utility, which is included in the base system.

  2. hebasto added the label Build system on Jan 9, 2025
  3. DrahtBot commented at 12:22 pm on January 9, 2025: 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/31626.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK davidgumberg
    Stale ACK l0rinc

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  4. in depends/builders/freebsd.mk:4 in f0b70fd7a1 outdated
    0@@ -1,5 +1,5 @@
    1 build_freebsd_CC=clang
    2 build_freebsd_CXX=clang++
    3 
    4-build_freebsd_SHA256SUM = shasum -a 256
    5+build_freebsd_SHA256SUM = sha256sum
    


    l0rinc commented at 12:46 pm on January 9, 2025:
    Doesn’t this apply to NetBSD as well?

    hebasto commented at 1:02 pm on January 9, 2025:

    No, it doesn’t, unfortunately.

    NetBSD’s sha256 is not quite compatible with our depends build system.

    We still have to rely on Perl’s shasum.

  5. l0rinc commented at 1:16 pm on January 9, 2025: contributor
    utACK f0b70fd7a1b1520502f99c516f8e1e3d83368d2c
  6. in depends/builders/darwin.mk:9 in f0b70fd7a1 outdated
     5@@ -6,7 +6,7 @@ build_darwin_STRIP:=$(shell xcrun -f strip)
     6 build_darwin_OBJDUMP:=$(shell xcrun -f objdump)
     7 build_darwin_NM:=$(shell xcrun -f nm)
     8 build_darwin_DSYMUTIL:=$(shell xcrun -f dsymutil)
     9-build_darwin_SHA256SUM=shasum -a 256
    10+build_darwin_SHA256SUM=sha256sum
    


    theuni commented at 8:19 pm on January 9, 2025:

    sha256sum has never existed by default on macOS afaik. That’s actually why this variable exists in the first place. perl or no, shasum is always there.

    sha256sum is still not present for me on Sonoma.


    hebasto commented at 8:25 pm on January 9, 2025:
    Thanks! This change has been dropped.

    l0rinc commented at 8:30 pm on January 9, 2025:
    hmmm, it was working for me on Sequoia - it likely comes from coreutils, right?

    hebasto commented at 8:31 pm on January 9, 2025:

    FWIW, on my Sequoia (Intel):

    0% whereis sha256sum                 
    1sha256sum: /sbin/sha256sum /usr/share/man/man1/sha256sum.1
    2% sha256sum --version
    3sha256sum (Darwin) 1.0
    

    theuni commented at 10:06 pm on January 9, 2025:
    Yes, it’s from coreutils. But shasum exists out of the box.
  7. depends: Use base system's `sha256sum` utility
    On FreeBSD, the `shasum` utility is provided by the `perl5` port, which
    is not part of the base system and must be installed separately.
    Note that this requirement is currently not documented in
    `depends/README.md`.
    
    This change switches to using the `sha256sum` utility, which is included
    in the base system.
    727c542769
  8. hebasto force-pushed on Jan 9, 2025
  9. maflcko commented at 8:32 am on January 10, 2025: member
    Could add freebsd to the title now?
  10. hebasto renamed this:
    depends: Use base system's `sha256sum` utility
    depends: Use base system's `sha256sum` utility on FreeBSD
    on Jan 10, 2025
  11. hebasto commented at 9:16 am on January 10, 2025: member

    Could add freebsd to the title now?

    Added.

  12. davidgumberg commented at 0:57 am on January 17, 2025: contributor

    ACK https://github.com/bitcoin/bitcoin/pull/31626/commits/727c54276967e001f43831db83c790a1dec7a598

    Tested depends build on a fresh BSD 14.2 image1, sha256sum is available and shasum is not.

    0root@freebsd:~ # freebsd-version
    114.2-RELEASE
    2root@freebsd:~ # shasum
    3-sh: shasum: not found
    4root@freebsd:~ # sha256sum --version
    5sha256sum (FreeBSD) 14.2
    
     0root@freebsd:~ # fetch https://github.com/bitcoin/bitcoin/archive/refs/heads/master.zip
     1root@freebsd:~ # sha256sum master.zip
     230cadd9f1293505f4e70173d9d1e3f763734773fd7ef943923bcce85e8fc0f7b  master.zip
     3root@freebsd:~ # tar -xf master.zip
     4root@freebsd:~ # pkg install -y bash gmake cmake-core curl
     5root@freebsd:~ # cd bitcoin-master/depends
     6root@freebsd:~/bitcoin-master/depends # sed -i '' 's/shasum -a 256/sha256sum/g' builders/freebsd.mk
     7root@freebsd:~/bitcoin-master/depends # gmake -j $(nproc)
     8# [...]
     9copying packages: boost libevent bdb sqlite zeromq
    10to: ~/bitcoin-master/depends/x86_64-unknown-freebsd14.2
    11To build Bitcoin Core with these packages, pass '--toolchain ~/bitcoin-master/depends/x86_64-unknown-freebsd14.2/toolchain.cmake' to the first CMake invocation.
    12root@freebsd:~/bitcoin-master/depends # cd ..
    13root@freebsd:~/bitcoin-master # cmake -B build --toolchain ~/bitcoin-master/depends/x86_64-unknown-freebsd14.2/toolchain.cmake
    14root@freebsd:~/bitcoin-master # cmake --build build -j $(nproc)
    

    Just to note: perl5 (and shasum) is installed as a dependency of git, and I believe gmake, curl, and cmake-core are also required for a depends build.


    1. https://download.freebsd.org/releases/VM-IMAGES/14.2-RELEASE/amd64/Latest/FreeBSD-14.2-RELEASE-amd64.qcow2.xz 75146ff57cb965624630da4e7113db3f54b26807b8e9ab9f5242212abeea0e99 FreeBSD-14.2-RELEASE-amd64.qcow2.xz ↩︎

  13. DrahtBot requested review from l0rinc on Jan 17, 2025
  14. in depends/builders/freebsd.mk:5 in 727c542769
    0@@ -1,5 +1,5 @@
    1 build_freebsd_CC=clang
    2 build_freebsd_CXX=clang++
    3 
    4-build_freebsd_SHA256SUM = shasum -a 256
    5+build_freebsd_SHA256SUM = sha256sum
    6 build_freebsd_DOWNLOAD = curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o
    


    davidgumberg commented at 1:12 am on January 17, 2025:
    0build_freebsd_DOWNLOAD = fetch --timeout 180 --retry -o
    

    related but probably out-of-scope: freebsd’s fetch utility could be used to also drop the curl dependency, there is a regression since it is unable to limit number of retries(16-year old patch awaits feedback), and to set a handshake timeout, but these can be approximated with a total connection life timeout

  15. fanquake merged this on Jan 17, 2025
  16. fanquake closed this on Jan 17, 2025

  17. hebasto referenced this in commit 8d1011cedc on Jan 17, 2025
  18. hebasto deleted the branch on Jan 17, 2025

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: 2025-01-21 03:12 UTC

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