[PATCH] Make compiler-rt tests work with relocatable SDKs on OS X

Kuba Brecka kuba.brecka at gmail.com
Mon Jun 9 18:26:41 PDT 2014


================
Comment at: compiler-rt/trunk/CMakeLists.txt:379
@@ +378,3 @@
+
+# We need c++ headers, on Darwin 10.9 there is no system-installed toolchain,
+# if we don't have libcxx, let's symlink to c++ directory provided with Xcode
----------------
Alexey Samsonov wrote:
> I don't like the idea of adding a symlink - it seems too brittle and unexpected that compiler-rt build would for some reason create a symlink in the build tree that would point to c++ headers. If you can't provide path to c++ headers in CMAKE_CXX_FLAGS when you configure a build tree, consider just modifying the compile flags using the output of xcrun.
Providing the path in a variable (either externally or inside cmake) will make compiler-rt build and pass tests, however the output clang binary would still be unable to compile C++ source out of the box:

  $ ../llvm-cmake/bin/clang a.cc
  a.cc:4:10: fatal error: 'string' file not found
  #include <string>
           ^
  1 error generated.

On other platforms this is not an issue, because you usually have /usr/include/c++. If this is expected/intentional, we should be more specific with the build instructions for OS X at http://clang.llvm.org/get_started.html.

================
Comment at: compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake:151
@@ +150,3 @@
+  list(APPEND COMPILER_RT_GTEST_CFLAGS -isysroot ${OSX_SDK_DIR})
+  list(APPEND ASAN_UNITTEST_COMMON_LINKFLAGS -isysroot ${OSX_SDK_DIR})
+  list(APPEND ASAN_UNITTEST_COMMON_LINKFLAGS -framework Foundation)
----------------
Alexey Samsonov wrote:
> Please don't use ASan-specific variables here.
is there something like COMPILER_RT_COMMON_LINKFLAGS? if not, can I introduce such a variable?

http://reviews.llvm.org/D4047






More information about the llvm-commits mailing list