depens: bdb build fails on Intel macOS 13.6.6 #29792

issue Sjors opened this issue on April 2, 2024
  1. Sjors commented at 4:56 PM on April 2, 2024: member

    Current behaviour

    Building BDB as part of depends fails with a permission denied error for creating a temporary directory. The directory exists after make fails. Deleting it and running make once more, creates it again and the same error is shown.

    Does not happen on my newer Intel macOS 14.4.1 machine.

    Expected behaviour

    make succeeds

    Steps to reproduce

    cd depends
    make NO_BOOST=1 NO_LIBEVENT=1 NO_QT=1 NO_SQLITE=1 NO_UPNP=1 NO_NATPMP=1 NO_USDT=1
    

    Relevant log output

    depends % make NO_BOOST=1 NO_LIBEVENT=1 NO_QT=1 NO_SQLITE=1 NO_UPNP=1 NO_NATPMP=1 NO_USDT=1
    Fetching db-4.8.30.NC.tar.gz from https://download.oracle.com/berkeley-db
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 21.7M  100 21.7M    0     0  15.4M      0  0:00:01  0:00:01 --:--:-- 15.4M
    /.../bitcoin-depends/depends/work/download/bdb-4.8.30/db-4.8.30.NC.tar.gz.temp: OK
    Extracting bdb...
    /.../bitcoin-depends/depends/sources/db-4.8.30.NC.tar.gz: OK
    Preprocessing bdb...
    patching file 'dbinc/atomic.h'
    Can't create '/var/folders/qp/bskkps293_v5w198m17h7zrm0000gn/T/patcho2C1xcCJMLh', output is in '/var/folders/qp/bskkps293_v5w198m17h7zrm0000gn/T/patcho2C1xcCJMLh': Permission denied
    patch: **** can't create '/var/folders/qp/bskkps293_v5w198m17h7zrm0000gn/T/patcho2C1xcCJMLh': Permission denied
    make: *** [/.../bitcoin-depends/depends/work/build/x86_64-apple-darwin22.6.0/bdb/4.8.30-c4f10ceb835/.stamp_preprocessed] Error 2
    

    How did you obtain Bitcoin Core

    Compiled from source

    What version of Bitcoin Core are you using?

    master@3b12fc7bcd94cf214984911f68612feb468d5404

    Operating system and version

    macOS 13.6.6

    Apple clang version 15.0.0

    Machine specifications

    Intel iMac 2017.

  2. Sjors commented at 5:08 PM on April 2, 2024: member

    Fixing the legacy wallet for old macOS versions doesn't seem high priority, but release-notes-empty-template.md mentions "macOS 11.0+" as the minimum we test on. My iMac from 2017 can't run anything newer than macOS 13.

  3. fanquake commented at 5:15 PM on April 2, 2024: member

    Are you sure this isn't a local (permissions/filesystem/something else) issue. Works fine for me on macOS 13.6.6.

  4. Sjors commented at 5:20 PM on April 2, 2024: member

    That's certainly possible, though it happens at different commits, which use different temp directories. And it happens for only with bdb while the other packages build fine. I'll try a reboot and wiping more temp stuff.


    Tried a reboot into safe mode, which should get rid of most temp files, and then a normal boot. Still the same issue.

  5. maflcko commented at 8:16 AM on April 3, 2024: member

    Can you build other packages with patches applied?

  6. Sjors commented at 12:00 PM on April 3, 2024: member

    @maflcko yes, e.g. it built boost and zmq just fine.

  7. willcl-ark added the label macOS on Apr 4, 2024
  8. maflcko commented at 10:28 AM on April 5, 2024: member

    What is your patch --version?

  9. Sjors commented at 10:49 AM on April 5, 2024: member

    patch 2.0-12u11-Apple (same on both machines)

  10. fanquake commented at 10:55 AM on April 5, 2024: member

    Can you produce a more minified set of steps/environment to reproduce. i.e does running the same set of build steps outside of depends also fail?

  11. Sjors commented at 12:06 PM on April 5, 2024: member

    On todays master 5a5ab1d5446693ee2655860c2f2920bcc3389c83:

    git clean -dfx
    cd depends
    make NO_BOOST=1 NO_LIBEVENT=1 NO_QT=1 NO_SQLITE=1 NO_UPNP=1 NO_NATPMP=1 NO_USDT=1
    

    Immediately fails:

    Fetching db-4.8.30.NC.tar.gz from https://download.oracle.com/berkeley-db
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 21.7M  100 21.7M    0     0  19.2M      0  0:00:01  0:00:01 --:--:-- 19.2M
    /Volumes/SSD/Dev/bitcoin-depends/depends/work/download/bdb-4.8.30/db-4.8.30.NC.tar.gz.temp: OK
    Extracting bdb...
    /Volumes/SSD/Dev/bitcoin-depends/depends/sources/db-4.8.30.NC.tar.gz: OK
    Preprocessing bdb...
    patching file 'dbinc/atomic.h'
    Can't create '/var/folders/qp/bskkps293_v5w198m17h7zrm0000gn/T/patcho3S2H7ZTq3e', output is in '/var/folders/qp/bskkps293_v5w198m17h7zrm0000gn/T/patcho3S2H7ZTq3e': Permission denied
    patch: **** can't create '/var/folders/qp/bskkps293_v5w198m17h7zrm0000gn/T/patcho3S2H7ZTq3e': Permission denied
    make: *** [/Volumes/SSD/Dev/bitcoin-depends/depends/work/build/x86_64-apple-darwin22.6.0/bdb/4.8.30-b84f0e92434/.stamp_preprocessed] Error 2
    

    Starting from scratch:

    • make download-osx NO_BOOST=1 NO_LIBEVENT=1 NO_QT=1 NO_SQLITE=1 NO_UPNP=1 NO_NATPMP=1 NO_USDT=1
    • cd sources, tar -xzf db-4.8.30.NC.tar.gz, cd db-4.8.30.NC
    • patch -p1 < ../../patches/bdb/clang_cxx_11.patch

    That indeed fails the same way. Tried again by deleting db-4.8.30.NC and the temp folder (which does not require sudo).

    I then installed gpatch 2.7.6 (brew install gpatch && brew link gpatch --force --overwrite, open new terminal)

    This time it patches all the files:

    File dbinc/atomic.h is read-only; trying to patch anyway
    patching file dbinc/atomic.h
    File mp/mp_fget.c is read-only; trying to patch anyway
    patching file mp/mp_fget.c
    File mp/mp_mvcc.c is read-only; trying to patch anyway
    patching file mp/mp_mvcc.c
    File mp/mp_region.c is read-only; trying to patch anyway
    patching file mp/mp_region.c
    File mutex/mut_method.c is read-only; trying to patch anyway
    patching file mutex/mut_method.c
    File mutex/mut_tas.c is read-only; trying to patch anyway
    patching file mutex/mut_tas.c
    

    And indeed make depends works once this is in place.

    Installing gnu patch seems like an acceptable workaround, but if it's silently ignoring failed patch attempts because something is read-only that's not good.

    On the newer macOS machine the patch command (Apple built in) does not throw warnings:

     patch -p1 < ../../patches/bdb/clang_cxx_11.patch
    patching file 'dbinc/atomic.h'
    patching file 'mp/mp_fget.c'
    patching file 'mp/mp_mvcc.c'
    patching file 'mp/mp_region.c'
    patching file 'mutex/mut_method.c'
    patching file 'mutex/mut_tas.c'
    

    Turns out these files are indeed read-only, but that's the case on both versions of macOS:

    % ls -al dbinc/atomic.h
    -r--r--r--  1 sjors  staff  6583 12 apr  2010 dbinc/atomic.h
    
  12. maflcko added the label Upstream on Apr 5, 2024
  13. maflcko commented at 12:09 PM on April 5, 2024: member

    So can it be closed, or is there something that points to a problem in this repo that can be fixed here?

  14. Sjors commented at 1:58 PM on April 5, 2024: member

    I'm still running the test suite to see if it's not broken. The machine is quite slow.

    At minimum we should add gnu patch to the list of requirements / recommendations, at least for macOS < 14.


    Update: legacy wallet tests pass, so it seems the read-only warnings were safe to ignore.

  15. Sjors referenced this in commit f23f96dad8 on Apr 5, 2024
  16. laanwj commented at 10:01 AM on April 14, 2024: member

    Looks like it's resolved? As a rare issue with a dependency that's going away anyhow, i think this can be closed.

  17. Sjors closed this on Apr 16, 2024

  18. Sjors commented at 8:02 AM on April 23, 2024: member

    I wiped the disk and reinstalled macOS 13.6.6. Still getting the permission denied error.

    I narrowed it down further: this only happens when I clone the repo on my external SSD drive, not when it's on the built in disk (which is slow, so I do most dev work on the external ssd).

    Preprocessing bdb...
    patching file 'dbinc/atomic.h'
    Can't create '/var/folders/6c/n_bj8h8s0212j2tdtk_c_93m0000gn/T/patchogFOtRafNrn', output is in '/var/folders/6c/n_bj8h8s0212j2tdtk_c_93m0000gn/T/patchogFOtRafNrn': Permission denied
    patch: **** can't create '/var/folders/6c/n_bj8h8s0212j2tdtk_c_93m0000gn/T/patchogFOtRafNrn': Permission denied
    make: *** [/Volumes/SSD/test/bitcoin/depends/work/build/x86_64-apple-darwin22.6.0/bdb/4.8.30-0de9a3a86cb/.stamp_preprocessed] Error 2
    
    • /var is on the internal disk
    • /Volumes/SSD is the external SSD drive (encrypted APFS)

    I can always debug it further if we encounter it in another dependency.

  19. maflcko commented at 8:09 AM on April 23, 2024: member

    Does macOS, or patch respect TMPDIR, TMP, TEMP, or TEMPDIR? If yes, it could be used as a temporary workaround.

  20. Sjors commented at 8:44 AM on April 23, 2024: member

    It seems to:

    mkdir /tmp/test
    
    % TMPDIR=/tmp/test  make NO_BOOST=1 NO_LIBEVENT=1 NO_QT=1 NO_SQLITE=1 NO_UPNP=1 NO_NATPMP=1 NO_USDT=1
    Preprocessing bdb...
    patching file 'dbinc/atomic.h'
    Can't create '/tmp/test/patchoSHQPQFIlmq', output is in '/tmp/test/patchoSHQPQFIlmq': Permission denied
    patch: **** can't create '/tmp/test/patchoSHQPQFIlmq': Permission denied
    make: *** [/Volumes/SSD/test/bitcoin/depends/work/build/x86_64-apple-darwin22.6.0/bdb/4.8.30-0de9a3a86cb/.stamp_preprocessed] Error 2
    

    It seems to want the temp dir to live on the same volume:

    TMPDIR=/Volumes/SSD/temp/test  make ...
    

    ^ works

  21. bitcoin locked this on Apr 23, 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: 2026-04-29 21:13 UTC

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