mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 03:47:29 -03:00
Merge bitcoin/bitcoin#21793: build: use -isysroot
over --sysroot
on macOS
cf971c9ea0
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](3e037f8f0e/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`](3e037f8f0e/clang/lib/Driver/ToolChains/Darwin.cpp (L2656)
), which is added if the linker is [new enough](3e037f8f0e/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](3e037f8f0e/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: tACKcf971c9ea0
hebasto: re-ACKcf971c9ea0
, only rebased and addressed comments since my [previous](https://github.com/bitcoin/bitcoin/pull/21793#pullrequestreview-647321518) review. Tree-SHA512: f01138179fb85083b5505bbaa48810451098ffa4da5d3c9b673785448790aa76f2e64b2aab6e698f6ee378a21f70626445a3fabee7c61dbfc44e96f3e3964656
This commit is contained in:
commit
bb11a988fa
3 changed files with 7 additions and 7 deletions
|
@ -56,7 +56,7 @@ Working macOS DMGs are created in Linux by combining a recent `clang`, the Apple
|
||||||
|
|
||||||
Apple uses `clang` extensively for development and has upstreamed the necessary
|
Apple uses `clang` extensively for development and has upstreamed the necessary
|
||||||
functionality so that a vanilla clang can take advantage. It supports the use of `-F`,
|
functionality so that a vanilla clang can take advantage. It supports the use of `-F`,
|
||||||
`-target`, `-mmacosx-version-min`, and `--sysroot`, which are all necessary when
|
`-target`, `-mmacosx-version-min`, and `-isysroot`, which are all necessary when
|
||||||
building for macOS.
|
building for macOS.
|
||||||
|
|
||||||
Apple's version of `binutils` (called `cctools`) contains lots of functionality missing in the
|
Apple's version of `binutils` (called `cctools`) contains lots of functionality missing in the
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
build_darwin_CC:=$(shell xcrun -f clang) --sysroot $(shell xcrun --show-sdk-path)
|
build_darwin_CC:=$(shell xcrun -f clang) -isysroot$(shell xcrun --show-sdk-path)
|
||||||
build_darwin_CXX:=$(shell xcrun -f clang++) --sysroot $(shell xcrun --show-sdk-path)
|
build_darwin_CXX:=$(shell xcrun -f clang++) -isysroot$(shell xcrun --show-sdk-path)
|
||||||
build_darwin_AR:=$(shell xcrun -f ar)
|
build_darwin_AR:=$(shell xcrun -f ar)
|
||||||
build_darwin_RANLIB:=$(shell xcrun -f ranlib)
|
build_darwin_RANLIB:=$(shell xcrun -f ranlib)
|
||||||
build_darwin_STRIP:=$(shell xcrun -f strip)
|
build_darwin_STRIP:=$(shell xcrun -f strip)
|
||||||
|
@ -10,8 +10,8 @@ build_darwin_SHA256SUM=shasum -a 256
|
||||||
build_darwin_DOWNLOAD=curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o
|
build_darwin_DOWNLOAD=curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o
|
||||||
|
|
||||||
#darwin host on darwin builder. overrides darwin host preferences.
|
#darwin host on darwin builder. overrides darwin host preferences.
|
||||||
darwin_CC=$(shell xcrun -f clang) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(shell xcrun --show-sdk-path)
|
darwin_CC=$(shell xcrun -f clang) -mmacosx-version-min=$(OSX_MIN_VERSION) -isysroot$(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)
|
darwin_CXX:=$(shell xcrun -f clang++) -mmacosx-version-min=$(OSX_MIN_VERSION) -stdlib=libc++ -isysroot$(shell xcrun --show-sdk-path)
|
||||||
darwin_AR:=$(shell xcrun -f ar)
|
darwin_AR:=$(shell xcrun -f ar)
|
||||||
darwin_RANLIB:=$(shell xcrun -f ranlib)
|
darwin_RANLIB:=$(shell xcrun -f ranlib)
|
||||||
darwin_STRIP:=$(shell xcrun -f strip)
|
darwin_STRIP:=$(shell xcrun -f strip)
|
||||||
|
|
|
@ -100,7 +100,7 @@ darwin_CC=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
|
||||||
-u LIBRARY_PATH \
|
-u LIBRARY_PATH \
|
||||||
$(clang_prog) --target=$(host) -mmacosx-version-min=$(OSX_MIN_VERSION) \
|
$(clang_prog) --target=$(host) -mmacosx-version-min=$(OSX_MIN_VERSION) \
|
||||||
-B$(build_prefix)/bin -mlinker-version=$(LD64_VERSION) \
|
-B$(build_prefix)/bin -mlinker-version=$(LD64_VERSION) \
|
||||||
--sysroot=$(OSX_SDK) \
|
-isysroot$(OSX_SDK) \
|
||||||
-Xclang -internal-externc-isystem$(clang_resource_dir)/include \
|
-Xclang -internal-externc-isystem$(clang_resource_dir)/include \
|
||||||
-Xclang -internal-externc-isystem$(OSX_SDK)/usr/include
|
-Xclang -internal-externc-isystem$(OSX_SDK)/usr/include
|
||||||
darwin_CXX=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
|
darwin_CXX=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
|
||||||
|
@ -108,7 +108,7 @@ darwin_CXX=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
|
||||||
-u LIBRARY_PATH \
|
-u LIBRARY_PATH \
|
||||||
$(clangxx_prog) --target=$(host) -mmacosx-version-min=$(OSX_MIN_VERSION) \
|
$(clangxx_prog) --target=$(host) -mmacosx-version-min=$(OSX_MIN_VERSION) \
|
||||||
-B$(build_prefix)/bin -mlinker-version=$(LD64_VERSION) \
|
-B$(build_prefix)/bin -mlinker-version=$(LD64_VERSION) \
|
||||||
--sysroot=$(OSX_SDK) \
|
-isysroot$(OSX_SDK) \
|
||||||
-stdlib=libc++ -nostdinc++ \
|
-stdlib=libc++ -nostdinc++ \
|
||||||
-Xclang -cxx-isystem$(OSX_SDK)/usr/include/c++/v1 \
|
-Xclang -cxx-isystem$(OSX_SDK)/usr/include/c++/v1 \
|
||||||
-Xclang -internal-externc-isystem$(clang_resource_dir)/include \
|
-Xclang -internal-externc-isystem$(clang_resource_dir)/include \
|
||||||
|
|
Loading…
Reference in a new issue