Skip to content

Commit 60c55b1

Browse files
committed
depends: Add justifications for macOS clang flags
1 parent 6b8e497 commit 60c55b1

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

depends/hosts/darwin.mk

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,28 @@ LD64_VERSION=530
66

77
OSX_SDK=$(SDK_PATH)/Xcode-$(XCODE_VERSION)-$(XCODE_BUILD_ID)-extracted-SDK-with-libcxx-headers
88

9-
# When cross-compiling for Darwin using Clang, -mlinker-version must be passed to
10-
# ensure that modern linker features are enabled.
9+
# Flag explanations:
10+
#
11+
# -mlinker-version
12+
#
13+
# Ensures that modern linker features are enabled. See here for more
14+
# details: https://github.com/bitcoin/bitcoin/pull/19407.
15+
#
16+
# -B$(build_prefix)/bin
17+
#
18+
# Explicitly point to our binaries (e.g. cctools) so that they are
19+
# ensured to be found and preferred over other possibilities.
20+
#
21+
# -nostdinc++ -isystem $(OSX_SDK)/usr/include/c++/v1
22+
#
23+
# Forces clang to use the libc++ headers from our SDK and completely
24+
# forget about the libc++ headers from the standard directories
25+
#
26+
# TODO: Once we start requiring a clang version that has the
27+
# -stdlib++-isystem<directory> flag first introduced here:
28+
# https://reviews.llvm.org/D64089, we should use that instead. Read the
29+
# differential summary there for more details.
30+
#
1131
darwin_CC=clang -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION) -B$(build_prefix)/bin
1232
darwin_CXX=clang++ -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -stdlib=libc++ -mlinker-version=$(LD64_VERSION) -B$(build_prefix)/bin -nostdinc++ -isystem $(OSX_SDK)/usr/include/c++/v1
1333

0 commit comments

Comments
 (0)