depends: suggest GNU patch for macOS <= 13 #29814

pull Sjors wants to merge 1 commits into bitcoin:master from Sjors:2024/04/gnu-patch changing 1 files +7 −0
  1. Sjors commented at 2:25 pm on April 5, 2024: member

    Fixes #29792

    Adds a note to depends/README.md that on older versions of macOS you may need to use GNU patch. I phrased as a troubleshooting hint, rather than make it a default recommendation, because:

    1. so far only I ran into it, and fanquake couldn’t reproduce
    2. BDB is only used for the legacy wallet, which itself is deprecated
    3. it seems better to replace as few default tools on macOS as possible

    The instructions in build-osx.md don’t even mention depends, so I don’t touch those here.

  2. depends: suggest GNU patch
    Fixes #29792
    f23f96dad8
  3. DrahtBot commented at 2:25 pm on April 5, 2024: contributor

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

    Code Coverage

    For detailed information about the code coverage, see the test coverage report.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    Concept ACK laanwj

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

  4. DrahtBot added the label Build system on Apr 5, 2024
  5. Sjors renamed this:
    depends: suggest GNU patch
    depends: suggest GNU patch for old macOS
    on Apr 5, 2024
  6. Sjors renamed this:
    depends: suggest GNU patch for old macOS
    depends: suggest GNU patch for macOS <= 13
    on Apr 5, 2024
  7. TheCharlatan commented at 2:48 pm on April 5, 2024: contributor
    I am building depends on macos 12.7.4 and am not seeing any patch related errors or warning. Seems weird that this suddenly pops up now after having worked for a long time? I checked my brew list and don’t have any entries for “patch” or “gpatch” and when I run which patch, it is in /usr/bin, so seems like it is just the default program?
  8. fanquake commented at 2:50 pm on April 5, 2024: member
    Yea. I’m also sure that my macOS 13.6.6 system is using the default apple patch (will double check), and I don’t see any issues.
  9. Sjors commented at 4:03 pm on April 5, 2024: member

    Seems weird that this suddenly pops up now after having worked for a long time?

    I agree. It’s worked fine for me too on this machine back in the day, say 2017-2019. Replacing the built-in patch with GNU patch immediately fixed it, so it does seem related.

  10. fanquake commented at 4:06 pm on April 5, 2024: member

    say 2017-2019.

    So it stopped working in 2019, but you only reported it in 2024?

    Given that there are 3 machines here, 2 where it always has worked, and continues to work, and one where it used to work, and now no-longer does, it would seem more likely that something has changed on your machine?

  11. Sjors commented at 4:07 pm on April 5, 2024: member

    So it stopped working in 2019, but you only reported it in 2024?

    No, I bought a faster machine in 2019 which I’ve been using for most compilation work. I may have run a depends build on the old machine since then, but I don’t know when the last time was.

    Since Apple no longer ships new macOS versions for the 2017 iMac it’s become useful for backwards compatibility tests. But that’s only been since this fall.

    it would seem more likely that something has changed on your machine?

    Possible.

    I’ll mark this draft for now, let’s see if someone else runs into it.

  12. Sjors marked this as a draft on Apr 5, 2024
  13. Sjors commented at 4:13 pm on April 5, 2024: member

    On both machines:

    0/usr/bin/patch --version
    1patch 2.0-12u11-Apple
    

    On the old machine:

     0shasum -a 256 /usr/bin/patch 
     11c7648162c11d32aa0ee1a05a948a8a548e4a9336106704a43ab986f718efb88  /usr/bin/patch
     2
     3% codesign -dv --verbose=4 /usr/bin/patch 
     4Executable=/usr/bin/patch
     5Identifier=com.apple.patch
     6Format=Mach-O universal (x86_64 arm64e)
     7CodeDirectory v=20400 size=872 flags=0x0(none) hashes=22+2 location=embedded
     8Platform identifier=14
     9VersionPlatform=1
    10VersionMin=853504
    11VersionSDK=853504
    12Hash type=sha256 size=32
    13CandidateCDHash sha256=8cabf498b11a70dfc7d8a1d069c71dafd7e54b69
    14CandidateCDHashFull sha256=8cabf498b11a70dfc7d8a1d069c71dafd7e54b691400e544af965b9d2f495b73
    15Hash choices=sha256
    16CMSDigest=8cabf498b11a70dfc7d8a1d069c71dafd7e54b691400e544af965b9d2f495b73
    17CMSDigestType=2
    18Executable Segment base=0
    19Executable Segment limit=49152
    20Executable Segment flags=0x1
    21Page size=4096
    22Launch Constraints:
    23	None
    24CDHash=8cabf498b11a70dfc7d8a1d069c71dafd7e54b69
    25Signature size=4442
    26Authority=Software Signing
    27Authority=Apple Code Signing Certification Authority
    28Authority=Apple Root CA
    29Signed Time=28 Oct 2023 at 17:26:45
    30Info.plist=not bound
    31TeamIdentifier=not set
    32Sealed Resources=none
    33Internal requirements count=1 size=64
    

    On the new machine:

     0shasum -a 256 /usr/bin/patch 
     1214df67037191e570a95ddfe1427ebaad7c756f53348584d981759309d3dd489  /usr/bin/patch
     2
     3% codesign -dv --verbose=4 /usr/bin/patch 
     4Executable=/usr/bin/patch
     5Identifier=com.apple.patch
     6Format=Mach-O universal (x86_64 arm64e)
     7CodeDirectory v=20400 size=680 flags=0x0(none) hashes=16+2 location=embedded
     8Platform identifier=15
     9VersionPlatform=1
    10VersionMin=918528
    11VersionSDK=918528
    12Hash type=sha256 size=32
    13CandidateCDHash sha256=9954ffa8ef205ae003a22e2635f467d496708e1e
    14CandidateCDHashFull sha256=9954ffa8ef205ae003a22e2635f467d496708e1e48fae4425b758307eee58615
    15Hash choices=sha256
    16CMSDigest=9954ffa8ef205ae003a22e2635f467d496708e1e48fae4425b758307eee58615
    17CMSDigestType=2
    18Executable Segment base=0
    19Executable Segment limit=49152
    20Executable Segment flags=0x1
    21Page size=4096
    22CDHash=9954ffa8ef205ae003a22e2635f467d496708e1e
    23Signature size=4442
    24Authority=Software Signing
    25Authority=Apple Code Signing Certification Authority
    26Authority=Apple Root CA
    27Signed Time=10 Feb 2024 at 09:02:40
    28Info.plist=not bound
    29TeamIdentifier=not set
    30Sealed Resources=none
    31Internal requirements count=1 size=64
    

    Both are Intel.

    Different code signature. Not sure how to check if the original is otherwise identical, or if they just got the version wrong. The SDK version is also different.

  14. TheCharlatan commented at 7:18 am on April 7, 2024: contributor
    Found this https://github.com/bazelbuild/bazel/issues/16550 issue that seems to describe what might be going. Sounds like it is only a macos 13 issue?
  15. laanwj commented at 10:03 am on April 14, 2024: member

    i would prefer not to require (nor suggest) any GNU tools on non-GNU operating systems, does this potentially affect any other deps besides bdb? Is it possible to figure out why this specific patch isn’t compatible with that apple patch (might indicate an ambiguity with the patch)?

    ACK on the way this is worded, anyhow. But we might just sit this out until bdb is gone.

    Edit: adding upstream label because it could be an upstream bug in the utility.

  16. in depends/README.md:52 in f23f96dad8
    43@@ -44,6 +44,13 @@ Common `host-platform-triplet`s for cross compilation are:
    44 
    45 The paths are automatically configured and no other options are needed unless targeting [Android](../doc/build-android.md).
    46 
    47+### Install the required dependencies: macOS
    48+
    49+If building BerkeleyDB fails on macOS 13 or older, install the GNU version
    50+of patch:
    51+
    52+    brew install gpatch
    


    maflcko commented at 10:24 am on April 14, 2024:
    Installing it would be insufficient anyway, because you’d still need to overwrite the global default?

    Sjors commented at 3:17 pm on April 16, 2024:

    Yes I left that out, because the command will tell you to.

    (also agree that we should at least wait until someone else runs into this - hopefully BDB will be gone before then)


    fanquake commented at 3:24 pm on April 16, 2024:

    (also agree that we should at least wait until someone else runs into this - hopefully BDB will be gone before then)

    Ok, well then lets close this for now, given there’s not really anything to review or do here, other than wait indefinitely for someone else to report the same thing (prior to BDB removal / maintainence end). If that does happen, I’m sure we’ll remember this PR.

  17. maflcko commented at 10:25 am on April 14, 2024: member
    Not sure. Anyone else on any version of macOS can build fine. So far only a single person ran into this issue, without steps to reproduce, so I am not sure about adjusting the docs.
  18. laanwj added the label Upstream on Apr 14, 2024
  19. Sjors closed this on Apr 16, 2024


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

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