<p dir="ltr">Sorry, haven't had time to look yet.<br>
Will try to do that tomorrow.</p>
<div class="gmail_quote">On Jun 6, 2014 11:44 PM, "Kuba Brecka" <<a href="mailto:kuba.brecka@gmail.com">kuba.brecka@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
I am trying to play a bit with ASan on OS X and I found out that on recent OS X releases, compiler-rt tests fail to build and run with CMake. That's because OS X now provides relocatable SDKs with Xcode and has no system-wide standard headers/libs. I am aware that currently compiler-rt tests are supported only with CMake.<br>

<br>
There are actually two issues:<br>
<br>
* Newly built clang binary can't find the platform SDK. Either the SDKROOT env has to be set or -isysroot passed on command line.<br>
* Newly build clang binary can't find c++ headers. It expects to find them in "../include/c++" relative to its binary. This issue goes away if you put libcxx into "llvm/projects/" and build libcxx simultaneously with llvm.<br>

<br>
My proposed patch adds OS X detection into CMake to add the -isysroot parameter and it creates a symlink pointing from the build directory's include/c++ into Xcode's toolchain (but only if you don't simultaneously build libcxx). It also moves a similar SDKROOT detection from clang's lit config into a util function and uses it in compiler-rt lit tests as well.<br>

<br>
One other solution to make the tests build and pass would be to enforce OS X users to set their SDKROOT env property (most OS X users don't have it set) and lit would need to be changed in a way to propagate this env property (it doesn't now). Installing a SDK into a system-wide location (e.g. /usr/include) is discouraged and deprecated on OS X, although manually installing Xcode Command Line Tools does that. Note that this will not solve the other issue (missing c++ headers).<br>

<br>
The attached patch is three files, which should go into llvm, compiler-rt and clang projects respectively.<br>
<br>
Kuba Brecka<br>
<br>
<a href="http://reviews.llvm.org/D4047" target="_blank">http://reviews.llvm.org/D4047</a><br>
<br>
Files:<br>
  cfe/trunk/test/lit.cfg<br>
  compiler-rt/trunk/CMakeLists.txt<br>
  compiler-rt/trunk/cmake/Modules/AddCompilerRT.cmake<br>
  compiler-rt/trunk/lib/asan/tests/CMakeLists.txt<br>
  compiler-rt/trunk/test/lit.common.cfg<br>
  llvm/trunk/utils/lit/lit/util.py<br>
<br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div>