depens: bdb build fails on Intel macOS 13.6.6 #29792

issue Sjors openend 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

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

    Relevant log output

     0depends % make NO_BOOST=1 NO_LIBEVENT=1 NO_QT=1 NO_SQLITE=1 NO_UPNP=1 NO_NATPMP=1 NO_USDT=1
     1Fetching db-4.8.30.NC.tar.gz from https://download.oracle.com/berkeley-db
     2  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
     3                                 Dload  Upload   Total   Spent    Left  Speed
     4100 21.7M  100 21.7M    0     0  15.4M      0  0:00:01  0:00:01 --:--:-- 15.4M
     5/.../bitcoin-depends/depends/work/download/bdb-4.8.30/db-4.8.30.NC.tar.gz.temp: OK
     6Extracting bdb...
     7/.../bitcoin-depends/depends/sources/db-4.8.30.NC.tar.gz: OK
     8Preprocessing bdb...
     9patching file 'dbinc/atomic.h'
    10Can't create '/var/folders/qp/bskkps293_v5w198m17h7zrm0000gn/T/patcho2C1xcCJMLh', output is in '/var/folders/qp/bskkps293_v5w198m17h7zrm0000gn/T/patcho2C1xcCJMLh': Permission denied
    11patch: **** can't create '/var/folders/qp/bskkps293_v5w198m17h7zrm0000gn/T/patcho2C1xcCJMLh': Permission denied
    12make: *** [/.../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:

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

    Immediately fails:

     0Fetching db-4.8.30.NC.tar.gz from https://download.oracle.com/berkeley-db
     1  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
     2                                 Dload  Upload   Total   Spent    Left  Speed
     3100 21.7M  100 21.7M    0     0  19.2M      0  0:00:01  0:00:01 --:--:-- 19.2M
     4/Volumes/SSD/Dev/bitcoin-depends/depends/work/download/bdb-4.8.30/db-4.8.30.NC.tar.gz.temp: OK
     5Extracting bdb...
     6/Volumes/SSD/Dev/bitcoin-depends/depends/sources/db-4.8.30.NC.tar.gz: OK
     7Preprocessing bdb...
     8patching file 'dbinc/atomic.h'
     9Can't create '/var/folders/qp/bskkps293_v5w198m17h7zrm0000gn/T/patcho3S2H7ZTq3e', output is in '/var/folders/qp/bskkps293_v5w198m17h7zrm0000gn/T/patcho3S2H7ZTq3e': Permission denied
    10patch: **** can't create '/var/folders/qp/bskkps293_v5w198m17h7zrm0000gn/T/patcho3S2H7ZTq3e': Permission denied
    11make: *** [/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:

     0File dbinc/atomic.h is read-only; trying to patch anyway
     1patching file dbinc/atomic.h
     2File mp/mp_fget.c is read-only; trying to patch anyway
     3patching file mp/mp_fget.c
     4File mp/mp_mvcc.c is read-only; trying to patch anyway
     5patching file mp/mp_mvcc.c
     6File mp/mp_region.c is read-only; trying to patch anyway
     7patching file mp/mp_region.c
     8File mutex/mut_method.c is read-only; trying to patch anyway
     9patching file mutex/mut_method.c
    10File mutex/mut_tas.c is read-only; trying to patch anyway
    11patching 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:

    0 patch -p1 < ../../patches/bdb/clang_cxx_11.patch
    1patching file 'dbinc/atomic.h'
    2patching file 'mp/mp_fget.c'
    3patching file 'mp/mp_mvcc.c'
    4patching file 'mp/mp_region.c'
    5patching file 'mutex/mut_method.c'
    6patching file 'mutex/mut_tas.c'
    

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

    0% ls -al dbinc/atomic.h
    1-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).

    0Preprocessing bdb...
    1patching file 'dbinc/atomic.h'
    2Can'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
    3patch: **** can't create '/var/folders/6c/n_bj8h8s0212j2tdtk_c_93m0000gn/T/patchogFOtRafNrn': Permission denied
    4make: *** [/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:

    0mkdir /tmp/test
    1
    2% 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
    3Preprocessing bdb...
    4patching file 'dbinc/atomic.h'
    5Can't create '/tmp/test/patchoSHQPQFIlmq', output is in '/tmp/test/patchoSHQPQFIlmq': Permission denied
    6patch: **** can't create '/tmp/test/patchoSHQPQFIlmq': Permission denied
    7make: *** [/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:

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

    ^ works


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-11-21 09:12 UTC

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