diff --git a/core/combo/HOST_darwin-x86.mk b/core/combo/HOST_darwin-x86.mk index c1c3caa366..076815bba1 100644 --- a/core/combo/HOST_darwin-x86.mk +++ b/core/combo/HOST_darwin-x86.mk @@ -47,7 +47,6 @@ $(combo_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG := $($(combo_2nd_arch_prefix)HO $(combo_2nd_arch_prefix)HOST_AR := $(AR) $(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -isysroot $(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version) -DMACOSX_DEPLOYMENT_TARGET=$(mac_sdk_version) -$(combo_2nd_arch_prefix)HOST_GLOBAL_CPPFLAGS += -isystem $(mac_sdk_path)/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 $(combo_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS += -isysroot $(mac_sdk_root) -Wl,-syslibroot,$(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version) $(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -fPIC -funwind-tables @@ -58,6 +57,10 @@ $(combo_2nd_arch_prefix)HOST_JNILIB_SUFFIX := .jnilib $(combo_2nd_arch_prefix)HOST_GLOBAL_ARFLAGS := cqs +# Use Darwin's libc++, as Darwin's libstdc++ is old and does not support C++11 +$(combo_2nd_arch_prefix)HOST_SYSTEMCPP_CPPFLAGS := -isystem $(mac_sdk_path)/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 +$(combo_2nd_arch_prefix)HOST_SYSTEMCPP_LDFLAGS := -stdlib=libc++ + ############################################################ ## Macros after this line are shared by the 64-bit config. diff --git a/core/combo/HOST_darwin-x86_64.mk b/core/combo/HOST_darwin-x86_64.mk index ce9d1bb296..a8541ee885 100644 --- a/core/combo/HOST_darwin-x86_64.mk +++ b/core/combo/HOST_darwin-x86_64.mk @@ -47,7 +47,6 @@ HOST_TOOLCHAIN_FOR_CLANG := $(HOST_TOOLCHAIN_ROOT) HOST_AR := $(AR) HOST_GLOBAL_CFLAGS += -isysroot $(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version) -DMACOSX_DEPLOYMENT_TARGET=$(mac_sdk_version) -HOST_GLOBAL_CPPFLAGS += -isystem $(mac_sdk_path)/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 HOST_GLOBAL_LDFLAGS += -isysroot $(mac_sdk_root) -Wl,-syslibroot,$(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version) HOST_GLOBAL_CFLAGS += -fPIC -funwind-tables @@ -58,6 +57,10 @@ HOST_JNILIB_SUFFIX := .jnilib HOST_GLOBAL_ARFLAGS := cqs +# Use Darwin's libc++, as Darwin's libstdc++ is old and does not support C++11 +HOST_SYSTEMCPP_CPPFLAGS := -isystem $(mac_sdk_path)/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 +HOST_SYSTEMCPP_LDFLAGS := -stdlib=libc++ + # We Reuse the following functions with the same name from HOST_darwin-x86.mk: # transform-host-o-to-shared-lib-inner # transform-host-o-to-executable-inner diff --git a/core/cxx_stl_setup.mk b/core/cxx_stl_setup.mk index 37be1f7cc8..0777645f59 100644 --- a/core/cxx_stl_setup.mk +++ b/core/cxx_stl_setup.mk @@ -110,8 +110,11 @@ else ifeq ($(my_cxx_stl),libstdc++) ifndef LOCAL_IS_HOST_MODULE my_c_includes += bionic/libstdc++/include my_system_shared_libraries += libstdc++ + else + # Host builds will use the system C++. libc++ on Darwin, GNU libstdc++ everywhere else + my_cppflags += $($(my_prefix)SYSTEMCPP_CPPFLAGS) + my_ldflags += $($(my_prefix)SYSTEMCPP_LDFLAGS) endif - # Host builds will use GNU libstdc++. else ifeq ($(my_cxx_stl),none) ifdef LOCAL_IS_HOST_MODULE my_cppflags += -nostdinc++ diff --git a/core/ninja.mk b/core/ninja.mk index 44c3ef3e1f..ef627c80d4 100644 --- a/core/ninja.mk +++ b/core/ninja.mk @@ -160,8 +160,8 @@ $(KATI_BUILD_NINJA): $(KATI) $(MAKEPARALLEL) $(SOONG_ANDROID_MK) FORCE +$(hide) $(KATI_MAKEPARALLEL) $(KATI) --ninja --ninja_dir=$(OUT_DIR) --ninja_suffix=$(KATI_NINJA_SUFFIX) --regen --ignore_dirty=$(OUT_DIR)/% --no_ignore_dirty=$(SOONG_ANDROID_MK) --ignore_optional_include=$(OUT_DIR)/%.P --detect_android_echo $(KATI_FIND_EMULATOR) -f build/core/main.mk $(KATI_GOALS) --gen_all_targets BUILDING_WITH_NINJA=true SOONG_ANDROID_MK=$(SOONG_ANDROID_MK) ifneq ($(USE_SOONG_FOR_KATI),true) -KATI_CXX := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_CFLAGS) $(CLANG_HOST_GLOBAL_CPPFLAGS) -KATI_LD := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_LDFLAGS) +KATI_CXX := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_CFLAGS) $(CLANG_HOST_GLOBAL_CPPFLAGS) $(HOST_SYSTEMCPP_CPPFLAGS) +KATI_LD := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_LDFLAGS) $(HOST_SYSTEMCPP_LDFLAGS) # Build static ckati. Unfortunately Mac OS X doesn't officially support static exectuables. ifeq ($(BUILD_OS),linux) # We need everything in libpthread.a otherwise C++11's threading library will be disabled. @@ -172,8 +172,8 @@ KATI_INTERMEDIATES_PATH := $(HOST_OUT_INTERMEDIATES)/EXECUTABLES/ckati_intermedi KATI_BIN_PATH := $(HOST_OUT_EXECUTABLES) include build/kati/Makefile.ckati -MAKEPARALLEL_CXX := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_CFLAGS) $(CLANG_HOST_GLOBAL_CPPFLAGS) -MAKEPARALLEL_LD := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_LDFLAGS) +MAKEPARALLEL_CXX := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_CFLAGS) $(CLANG_HOST_GLOBAL_CPPFLAGS) $(HOST_SYSTEMCPP_CPPFLAGS) +MAKEPARALLEL_LD := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_LDFLAGS) $(HOST_SYSTEMCPP_LDFLAGS) # Build static makeparallel. Unfortunately Mac OS X doesn't officially support static exectuables. ifeq ($(BUILD_OS),linux) MAKEPARALLEL_LD += -static