aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Yanofsky <russ@yanofsky.org>2020-03-04 10:56:07 -0500
committerRussell Yanofsky <russ@yanofsky.org>2020-04-22 08:18:11 -0500
commit1e94a2bcbc5ff8ae61eed9f31317ea534649116d (patch)
treecb5b66df399fda30bca1872c49d6125d1e094346
parent5dcb0615898216c503e965a01d855a5999a586b5 (diff)
depends: Add --sysroot option to mac os native compile flags
Catalina SDK clang stopped automatically searching the SDK include paths when invoked without --sysroot: https://github.com/bitcoin/bitcoin/pull/16367#issuecomment-594600985 https://github.com/Homebrew/homebrew-core/issues/45061 This hasn't been a problem for current native depends packages because are passing their own --sysroot values, and hasn't been a problem for current host packages because they use `darwin_` commands instead of `build_darwin_` commands. But the current `build_darwin_CC` and `build_darwin_CXX` commands are still unnecessarily fragile, and incompatible with new native depends packages added in https://github.com/bitcoin/bitcoin/pull/18677. Cory Fields <cory-nospam-@coryfields.com> suggested in https://github.com/bitcoin/bitcoin/pull/16367#issuecomment-595393546 switching compiler from SDK clang to native clang (from $PATH) to avoid this problem. This is easy and makes a certain amount of sense for building native packages, as opposed to host packages. But fanquake <fanquake@gmail.com> pointed out in https://github.com/bitcoin/bitcoin/pull/18677#discussion_r409934309 that it would be inconsistent use switch to non-SDK compilers while still using other SDK tools like ranlib and install_name_tool. So simplest, minimal fix seems to be just adding the missing --sysroot option.
-rw-r--r--depends/builders/darwin.mk4
1 files changed, 2 insertions, 2 deletions
diff --git a/depends/builders/darwin.mk b/depends/builders/darwin.mk
index eb587fca89..69c394ec1d 100644
--- a/depends/builders/darwin.mk
+++ b/depends/builders/darwin.mk
@@ -1,5 +1,5 @@
-build_darwin_CC:=$(shell xcrun -f clang)
-build_darwin_CXX:=$(shell xcrun -f clang++)
+build_darwin_CC:=$(shell xcrun -f clang) --sysroot $(shell xcrun --show-sdk-path)
+build_darwin_CXX:=$(shell xcrun -f clang++) --sysroot $(shell xcrun --show-sdk-path)
build_darwin_AR:=$(shell xcrun -f ar)
build_darwin_RANLIB:=$(shell xcrun -f ranlib)
build_darwin_STRIP:=$(shell xcrun -f strip)