Skip to content

Conversation

@Sjors
Copy link
Member

@Sjors Sjors commented Oct 12, 2019

Fixes errors like fatal error: 'unistd.h' file not found when building depends on macOS.

Replaces #14352 (which doesn't work on Catalina).

@fanquake fanquake changed the title [build] depends macOS: point --sysroot to SDK build: depends macOS: point --sysroot to SDK Oct 12, 2019
@Sjors Sjors mentioned this pull request Oct 12, 2019
darwin_CC=$(shell xcrun -f clang) -mmacosx-version-min=$(OSX_MIN_VERSION)
darwin_CXX:=$(shell xcrun -f clang++) -mmacosx-version-min=$(OSX_MIN_VERSION) -stdlib=libc++
darwin_CC=$(shell xcrun -f clang) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(shell xcrun --show-sdk-path)
darwin_CXX:=$(shell xcrun -f clang++) -mmacosx-version-min=$(OSX_MIN_VERSION) -stdlib=libc++ --sysroot $(shell xcrun --show-sdk-path)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why executing shell?
Is it really necessary?
The command should be also executed without shell (at least on my linux + zsh)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just copied the pattern @theuni used from other places in that file.

@DrahtBot
Copy link
Contributor

Gitian builds for commit 561a7d3 (master):

Gitian builds for commit 37adf88b0c4b644d7feac57429dca4f4791f2fd1 (master and this pull):

@Sjors
Copy link
Member Author

Sjors commented Oct 14, 2019

I'm able to run QT from bitcoin-0.19.99-osx64.tar.gz on macOS 10.15

@jonasschnelli
Copy link
Contributor

utACK a0daea4

laanwj added a commit that referenced this pull request Oct 16, 2019
a0daea4 [build] depends macOS: point --sysroot to SDK (Sjors Provoost)

Pull request description:

  Fixes errors like `fatal error: 'unistd.h' file not found` when building depends on macOS.

  Replaces #14352 (which doesn't work on Catalina).

ACKs for top commit:
  jonasschnelli:
    utACK a0daea4

Tree-SHA512: 995b1e1e84e635b32d1d4038bc63730c94a7c318b7240f6d62825977e5c97fe52c5aa5a0f39070beb0df8271dd294b36d6b5cf7f09ad07494fb15d5bd4d77f68
@laanwj laanwj merged commit a0daea4 into bitcoin:master Oct 16, 2019
@Sjors Sjors deleted the 2019/10/macos-sysroot branch October 16, 2019 07:54
UdjinM6 pushed a commit to UdjinM6/dash that referenced this pull request Oct 17, 2019
a0daea4 [build] depends macOS: point --sysroot to SDK (Sjors Provoost)

Pull request description:

  Fixes errors like `fatal error: 'unistd.h' file not found` when building depends on macOS.

  Replaces bitcoin#14352 (which doesn't work on Catalina).

ACKs for top commit:
  jonasschnelli:
    utACK a0daea4

Tree-SHA512: 995b1e1e84e635b32d1d4038bc63730c94a7c318b7240f6d62825977e5c97fe52c5aa5a0f39070beb0df8271dd294b36d6b5cf7f09ad07494fb15d5bd4d77f68
UdjinM6 added a commit to dashpay/dash that referenced this pull request Oct 19, 2019
)

a0daea4 [build] depends macOS: point --sysroot to SDK (Sjors Provoost)

Pull request description:

  Fixes errors like `fatal error: 'unistd.h' file not found` when building depends on macOS.

  Replaces bitcoin#14352 (which doesn't work on Catalina).

ACKs for top commit:
  jonasschnelli:
    utACK a0daea4

Tree-SHA512: 995b1e1e84e635b32d1d4038bc63730c94a7c318b7240f6d62825977e5c97fe52c5aa5a0f39070beb0df8271dd294b36d6b5cf7f09ad07494fb15d5bd4d77f68
codablock pushed a commit to codablock/dash that referenced this pull request Nov 19, 2019
…shpay#3161)

a0daea4 [build] depends macOS: point --sysroot to SDK (Sjors Provoost)

Pull request description:

  Fixes errors like `fatal error: 'unistd.h' file not found` when building depends on macOS.

  Replaces bitcoin#14352 (which doesn't work on Catalina).

ACKs for top commit:
  jonasschnelli:
    utACK a0daea4

Tree-SHA512: 995b1e1e84e635b32d1d4038bc63730c94a7c318b7240f6d62825977e5c97fe52c5aa5a0f39070beb0df8271dd294b36d6b5cf7f09ad07494fb15d5bd4d77f68
MIPPL pushed a commit to biblepay/biblepay that referenced this pull request Nov 24, 2019
* commit '8b14adb206d76fbc6307385999a1c512052e93fa': (21 commits)
  [v0.14.0.x] Update release notes with change log (dashpay#3213)
  [v0.14.0.x] Bump version to 0.14.0.4 and draft release notes (dashpay#3203)
  Circumvent BIP69 sorting in fundrawtransaction.py test (dashpay#3100)
  Fix compile issues
  Merge bitcoin#11397: net: Improve and document SOCKS code
  Slightly optimize ApproximateBestSubset and its usage for PS txes (dashpay#3184)
  Update activemn if protx info changed (dashpay#3176)
  Actually update spent index on DisconnectBlock (dashpay#3167)
  Only track last seen time instead of first and last seen time (dashpay#3165)
  Merge bitcoin#17118: build: depends macOS: point --sysroot to SDK (dashpay#3161)
  Simulate BlockConnected/BlockDisconnected for PS caches
  Few fixes related to SelectCoinsGroupedByAddresses (dashpay#3144)
  Various fixes for mixing queues (dashpay#3138)
  Also consider txindex for transactions in AlreadyHave() (dashpay#3126)
  Ignore recent rejects filter for locked txes (dashpay#3124)
  Make orphan TX map limiting dependent on total TX size instead of TX count (dashpay#3121)
  Update/modernize macOS plist (dashpay#3074)
  Fix bip69 vs change position issue (dashpay#3063)
  Partially revert 3061 (dashpay#3150)
  Fix SelectCoinsMinConf to allow instant respends (dashpay#3061)
  ...

# Conflicts:
#	configure.ac
#	doc/man/biblepay-cli.1
#	doc/man/biblepay-qt.1
#	doc/man/biblepay-tx.1
#	doc/man/biblepayd.1
#	doc/release-notes.md
#	src/clientversion.h
#	src/wallet/wallet.cpp
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Apr 3, 2020
Summary:
point --sysroot to SDK in order to support building on macOS Catalina

Backport of core [[ bitcoin/bitcoin#17118 | PR17118 ]].

Test Plan:
On macOS Catalina:
  cd depends
  make build-osx NO_PROTOBUF=1 # building protobuf fails, needs investigation

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix, rex4539

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D4816
ftrader pushed a commit to bitcoin-cash-node/bitcoin-cash-node that referenced this pull request Aug 17, 2020
Summary:
point --sysroot to SDK in order to support building on macOS Catalina

Backport of core [[ bitcoin/bitcoin#17118 | PR17118 ]].

Test Plan:
On macOS Catalina:
  cd depends
  make build-osx NO_PROTOBUF=1 # building protobuf fails, needs investigation

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix, rex4539

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D4816
random-zebra added a commit to PIVX-Project/PIVX that referenced this pull request Apr 29, 2021
4f90a19 [build] depends macOS: point --sysroot to SDK (Sjors Provoost)

Pull request description:

  Fixes errors like `fatal error: 'unistd.h' file not found` when building depends on macOS.

  Coming from bitcoin#17118.

ACKs for top commit:
  Fuzzbawls:
    utACK 4f90a19
  random-zebra:
    utACK 4f90a19 and merging...

Tree-SHA512: 9b757afa81335e8c9c0c1d3a283a87612d5e959506b290b6b7a65a643474e57fd3931081698f84f310609e5c28ba65f879fa90d905125ce6c97cbb38b6cad3b9
fanquake added a commit that referenced this pull request May 1, 2021
cf971c9 build: use -isysroot over --sysroot on macOS (fanquake)

Pull request description:

  Not only does this seem to be the more correct behaviour when targeting Darwin, but if you use `-isysroot`, Clangs Darwin driver will [infer the deployment target](https://github.com/llvm/llvm-project/blob/3e037f8f0e26acab8cc784ea4c7d05da79f7c22e/clang/lib/Driver/ToolChains/Darwin.cpp#L1652) from the SDK and use other SDK info when parsing arguments to the linker. In the case of [`-platform_version`](https://github.com/llvm/llvm-project/blob/3e037f8f0e26acab8cc784ea4c7d05da79f7c22e/clang/lib/Driver/ToolChains/Darwin.cpp#L2656), which is added if the linker is [new enough](https://github.com/llvm/llvm-project/blob/3e037f8f0e26acab8cc784ea4c7d05da79f7c22e/clang/lib/Driver/ToolChains/Darwin.cpp#L342), the version tuple is constructed from the SDKInfo, and SDKInfo, as far as I can tell, only exists when `-isysroot` has been passed, see [parseSDKSettings](https://github.com/llvm/llvm-project/blob/3e037f8f0e26acab8cc784ea4c7d05da79f7c22e/clang/lib/Driver/ToolChains/Darwin.cpp#L1785)

  As a result, the SDK version field in the `LC_BUILD_VERSION` command is filled out. i.e when building master:
  ```bash
        cmd LC_BUILD_VERSION
    cmdsize 32
   platform 1
      minos 10.14
        sdk n/a
     ntools 1
       tool 3
    version 650.9
  ```
  vs this PR:
  ```bash
        cmd LC_BUILD_VERSION
    cmdsize 32
   platform 1
      minos 10.14
        sdk 11.3
     ntools 1
       tool 3
    version 650.9
  ```

  This, from what I understand, will fix the issue we are having with Qt deciding wether or not to enable features like "Dark mode" on macOS, see #21771, however I have not tested that. Thus this is an alternative to #21782.

  Our usage of `--sysroot` was added in #17118.

  ```bash
  -isysroot <dir>         Set the system root directory (usually /)
  ```

ACKs for top commit:
  Sjors:
    tACK cf971c9
  hebasto:
    re-ACK cf971c9, only rebased and addressed comments since my [previous](#21793 (review)) review.

Tree-SHA512: f01138179fb85083b5505bbaa48810451098ffa4da5d3c9b673785448790aa76f2e64b2aab6e698f6ee378a21f70626445a3fabee7c61dbfc44e96f3e3964656
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 1, 2021
cf971c9 build: use -isysroot over --sysroot on macOS (fanquake)

Pull request description:

  Not only does this seem to be the more correct behaviour when targeting Darwin, but if you use `-isysroot`, Clangs Darwin driver will [infer the deployment target](https://github.com/llvm/llvm-project/blob/3e037f8f0e26acab8cc784ea4c7d05da79f7c22e/clang/lib/Driver/ToolChains/Darwin.cpp#L1652) from the SDK and use other SDK info when parsing arguments to the linker. In the case of [`-platform_version`](https://github.com/llvm/llvm-project/blob/3e037f8f0e26acab8cc784ea4c7d05da79f7c22e/clang/lib/Driver/ToolChains/Darwin.cpp#L2656), which is added if the linker is [new enough](https://github.com/llvm/llvm-project/blob/3e037f8f0e26acab8cc784ea4c7d05da79f7c22e/clang/lib/Driver/ToolChains/Darwin.cpp#L342), the version tuple is constructed from the SDKInfo, and SDKInfo, as far as I can tell, only exists when `-isysroot` has been passed, see [parseSDKSettings](https://github.com/llvm/llvm-project/blob/3e037f8f0e26acab8cc784ea4c7d05da79f7c22e/clang/lib/Driver/ToolChains/Darwin.cpp#L1785)

  As a result, the SDK version field in the `LC_BUILD_VERSION` command is filled out. i.e when building master:
  ```bash
        cmd LC_BUILD_VERSION
    cmdsize 32
   platform 1
      minos 10.14
        sdk n/a
     ntools 1
       tool 3
    version 650.9
  ```
  vs this PR:
  ```bash
        cmd LC_BUILD_VERSION
    cmdsize 32
   platform 1
      minos 10.14
        sdk 11.3
     ntools 1
       tool 3
    version 650.9
  ```

  This, from what I understand, will fix the issue we are having with Qt deciding wether or not to enable features like "Dark mode" on macOS, see bitcoin#21771, however I have not tested that. Thus this is an alternative to bitcoin#21782.

  Our usage of `--sysroot` was added in bitcoin#17118.

  ```bash
  -isysroot <dir>         Set the system root directory (usually /)
  ```

ACKs for top commit:
  Sjors:
    tACK cf971c9
  hebasto:
    re-ACK cf971c9, only rebased and addressed comments since my [previous](bitcoin#21793 (review)) review.

Tree-SHA512: f01138179fb85083b5505bbaa48810451098ffa4da5d3c9b673785448790aa76f2e64b2aab6e698f6ee378a21f70626445a3fabee7c61dbfc44e96f3e3964656
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants