[compiler-rt] r230847 - Fix OS X build failure with Command Line Tools and without full Xcode installation

Kuba Brecka kuba.brecka at gmail.com
Sat Feb 28 04:25:11 PST 2015


Author: kuba.brecka
Date: Sat Feb 28 06:25:10 2015
New Revision: 230847

URL: http://llvm.org/viewvc/llvm-project?rev=230847&view=rev
Log:
Fix OS X build failure with Command Line Tools and without full Xcode installation

On OS X, if you don't have a full Xcode installation, but just the Command Line Tools package, xcrun and xcodebuild don't return a valid SDK root path. In these cases, let's use "/" as the SDK root (which is where the headers and libraries are installed).

Reviewed at http://reviews.llvm.org/D7641


Modified:
    compiler-rt/trunk/CMakeLists.txt
    compiler-rt/trunk/make/platform/clang_darwin.mk

Modified: compiler-rt/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/CMakeLists.txt?rev=230847&r1=230846&r2=230847&view=diff
==============================================================================
--- compiler-rt/trunk/CMakeLists.txt (original)
+++ compiler-rt/trunk/CMakeLists.txt Sat Feb 28 06:25:10 2015
@@ -302,15 +302,20 @@ if(APPLE)
   set(SANITIZER_MIN_OSX_VERSION 10.7)
   set(CMAKE_OSX_DEPLOYMENT_TARGET "") # We're setting the flag manually below.
   set(DARWIN_osx_CFLAGS -mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION}
-    -isysroot ${OSX_SDK_DIR} -stdlib=libc++)
+    -stdlib=libc++)
   set(DARWIN_iossim_CFLAGS
     -mios-simulator-version-min=7.0 -isysroot ${IOSSIM_SDK_DIR})
   set(DARWIN_osx_LINKFLAGS -mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION}
-    -isysroot ${OSX_SDK_DIR} -stdlib=libc++)
+     -stdlib=libc++)
   set(DARWIN_iossim_LINKFLAGS
     -Wl,-ios_simulator_version_min,7.0.0
     -mios-simulator-version-min=7.0
     -isysroot ${IOSSIM_SDK_DIR})
+
+  if(OSX_SDK_DIR)
+    list(APPEND DARWIN_osx_CFLAGS -isysroot ${OSX_SDK_DIR})
+    list(APPEND DARWIN_osx_LINKFLAGS -isysroot ${OSX_SDK_DIR})
+  endif()
 endif()
 
 add_subdirectory(include)

Modified: compiler-rt/trunk/make/platform/clang_darwin.mk
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/make/platform/clang_darwin.mk?rev=230847&r1=230846&r2=230847&view=diff
==============================================================================
--- compiler-rt/trunk/make/platform/clang_darwin.mk (original)
+++ compiler-rt/trunk/make/platform/clang_darwin.mk Sat Feb 28 06:25:10 2015
@@ -175,7 +175,6 @@ CFLAGS.10.4		:= $(CFLAGS) $(OSX_DEPLOYME
 CFLAGS.asan_osx_dynamic := \
 	$(CFLAGS) -mmacosx-version-min=10.7 \
 	-stdlib=libc++ \
-	-isysroot $(OSX_SDK) \
 	-fno-builtin \
 	-gline-tables-only \
 	-DMAC_INTERPOSE_FUNCTIONS=1 \
@@ -190,7 +189,6 @@ CFLAGS.asan_iossim_dynamic := \
 	-DASAN_DYNAMIC=1
 
 CFLAGS.ubsan_osx := $(CFLAGS) -mmacosx-version-min=10.6 \
-	-isysroot $(OSX_SDK) \
 	-fno-builtin
 
 CFLAGS.ios.i386		:= $(CFLAGS) $(IOSSIM_DEPLOYMENT_ARGS)
@@ -225,8 +223,7 @@ CFLAGS.profile_ios.arm64  := $(CFLAGS) $
 # Configure the asan_osx_dynamic library to be built shared.
 SHARED_LIBRARY.asan_osx_dynamic := 1
 LDFLAGS.asan_osx_dynamic := -lc++ -undefined dynamic_lookup -install_name @rpath/libclang_rt.asan_osx_dynamic.dylib \
-  -mmacosx-version-min=10.7 \
-  -isysroot $(OSX_SDK)
+  -mmacosx-version-min=10.7
 
 # Configure the asan_iossim_dynamic library to be built shared.
 SHARED_LIBRARY.asan_iossim_dynamic := 1
@@ -236,6 +233,13 @@ LDFLAGS.asan_iossim_dynamic := -undefine
   -Wl,-ios_simulator_version_min,7.0.0 \
   -mios-simulator-version-min=7.0 -isysroot $(IOSSIM_SDK)
 
+ifneq ($(OSX_SDK),)
+CFLAGS.asan_osx_dynamic += -isysroot $(OSX_SDK)
+LDFLAGS.asan_osx_dynamic += -isysroot $(OSX_SDK)
+CFLAGS.ubsan_osx += -isysroot $(OSX_SDK)
+LDFLAGS.ubsan_osx += -isysroot $(OSX_SDK)
+endif
+
 FUNCTIONS.eprintf := eprintf
 FUNCTIONS.10.4 := eprintf floatundidf floatundisf floatundixf
 





More information about the llvm-commits mailing list