mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-09 02:59:31 +08:00
depends: use -Xclang -fno-cxx-modules in macOS cross build
Newer versions of the macOS SDK, have introduced code like: ```cpp if defined(__has_feature) && __has_feature(modules) define USE_CLANG_TYPES 1 else define USE_CLANG_TYPES 0 endif if USE_CLANG_TYPES include <sys/_types/_ptrdiff_t.h> include <sys/_types/_size_t.h> include <sys/_types/_va_list.h> include <sys/_types/_wchar_t.h> endif ``` which is currently causing compile failures due to undeclared types, which manifest when C++ modules are enabled. Note that the usage of "modules" in LLVM is can be a bit ambiguous, see: https://github.com/llvm/llvm-project/issues/55891. For now, explcitly disable cxx modules using `-fno-cxx-modules`. This resolves the include/compilation issues. Related discussion: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116827 https://github.com/llvm/llvm-project/pull/150349 https://github.com/llvm/llvm-project/issues/57432
This commit is contained in:
@@ -50,6 +50,12 @@ darwin_STRIP=$(shell $(SHELL) $(.SHELLFLAGS) "command -v llvm-strip")
|
||||
#
|
||||
# Disable adhoc codesigning (for now) when using LLVM tooling, to avoid
|
||||
# non-determinism issues with the Identifier field.
|
||||
#
|
||||
# -Xclang -fno-cxx-modules
|
||||
#
|
||||
# Disable C++ modules. We don't use these, and modules cause definition issues
|
||||
# in the SDK, where __has_feature(modules) is used to define USE_CLANG_TYPES,
|
||||
# which is in turn used as an include guard.
|
||||
|
||||
darwin_CC=$(clang_prog) --target=$(host) \
|
||||
-isysroot$(OSX_SDK) -nostdlibinc \
|
||||
@@ -61,7 +67,7 @@ darwin_CXX=$(clangxx_prog) --target=$(host) \
|
||||
-iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks
|
||||
|
||||
darwin_CFLAGS=-mmacos-version-min=$(OSX_MIN_VERSION)
|
||||
darwin_CXXFLAGS=-mmacos-version-min=$(OSX_MIN_VERSION)
|
||||
darwin_CXXFLAGS=-mmacos-version-min=$(OSX_MIN_VERSION) -Xclang -fno-cxx-modules
|
||||
darwin_LDFLAGS=-Wl,-platform_version,macos,$(OSX_MIN_VERSION),$(OSX_SDK_VERSION)
|
||||
|
||||
ifneq ($(build_os),darwin)
|
||||
|
||||
Reference in New Issue
Block a user