<div dir="ltr">Which version of Darwin? Is it a buildbot failure?<div><br></div><div>If check-asan worked before and this patch broke it, then please revert. Thanks.</div><div><br></div><div>Kuba</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 11, 2014 at 2:18 AM, Alexander Potapenko <span dir="ltr"><<a href="mailto:glider@google.com" target="_blank">glider@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Apparently this broke `make check-asan` on Darwin.<br>
I'll check whether the problem can be fixed easily or revert otherwise.<br>
<br>
On Wed, Sep 10, 2014 at 9:23 PM, Kuba Brecka <<a href="mailto:kuba.brecka@gmail.com">kuba.brecka@gmail.com</a>> wrote:<br>
> Author: kuba.brecka<br>
> Date: Wed Sep 10 12:23:58 2014<br>
> New Revision: 217523<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=217523&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=217523&view=rev</a><br>
> Log:<br>
> Make compiler-rt tests work with relocatable SDKs on OS X<br>
><br>
> Reviewed at <a href="http://reviews.llvm.org/D4047" target="_blank">http://reviews.llvm.org/D4047</a><br>
><br>
><br>
> Modified:<br>
>     compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake<br>
>     compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt<br>
><br>
> Modified: compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake?rev=217523&r1=217522&r2=217523&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake?rev=217523&r1=217522&r2=217523&view=diff</a><br>
> ==============================================================================<br>
> --- compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake (original)<br>
> +++ compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake Wed Sep 10 12:23:58 2014<br>
> @@ -11,6 +11,9 @@ macro(clang_compile object_file source)<br>
>    if(NOT COMPILER_RT_STANDALONE_BUILD)<br>
>      list(APPEND SOURCE_DEPS clang)<br>
>    endif()<br>
> +  if (TARGET CompilerRTUnitTestCheckCxx)<br>
> +    list(APPEND SOURCE_DEPS CompilerRTUnitTestCheckCxx)<br>
> +  endif()<br>
>    string(REGEX MATCH "[.](cc|cpp)$" is_cxx ${source_rpath})<br>
>    if(is_cxx)<br>
>      string(REPLACE " " ";" global_flags "${CMAKE_CXX_FLAGS}")<br>
> @@ -36,3 +39,41 @@ macro(clang_compile object_file source)<br>
>      MAIN_DEPENDENCY ${source}<br>
>      DEPENDS ${SOURCE_DEPS})<br>
>  endmacro()<br>
> +<br>
> +# On Darwin, there are no system-wide C++ headers and the just-built clang is<br>
> +# therefore not able to compile C++ files unless they are copied/symlinked into<br>
> +# ${LLVM_BINARY_DIR}/include/c++<br>
> +# The just-built clang is used to build compiler-rt unit tests. Let's detect<br>
> +# this before we try to build the tests and print out a suggestion how to fix<br>
> +# it.<br>
> +# On other platforms, this is currently not an issue.<br>
> +macro(clang_compiler_add_cxx_check)<br>
> +  if (APPLE)<br>
> +    set(CMD<br>
> +      "echo '#include <iostream>' | ${COMPILER_RT_TEST_COMPILER} -E -x c++ - > /dev/null"<br>
> +      "if [ $? != 0 ] "<br>
> +      "  then echo"<br>
> +      "  echo 'Your just-built clang cannot find C++ headers, which are needed to build and run compiler-rt tests.'"<br>
> +      "  echo 'You should copy or symlink your system C++ headers into ${LLVM_BINARY_DIR}/include/c++'"<br>
> +      "  if [ -d $(dirname $(dirname $(xcrun -f clang)))/include/c++ ]"<br>
> +      "    then echo 'e.g. with:'"<br>
> +      "    echo '  cp -r' $(dirname $(dirname $(xcrun -f clang)))/include/c++ '${LLVM_BINARY_DIR}/include/'"<br>
> +      "  elif [ -d $(dirname $(dirname $(xcrun -f clang)))/lib/c++ ]"<br>
> +      "    then echo 'e.g. with:'"<br>
> +      "    echo '  cp -r' $(dirname $(dirname $(xcrun -f clang)))/lib/c++ '${LLVM_BINARY_DIR}/include/'"<br>
> +      "  fi"<br>
> +      "  echo 'This can also be fixed by checking out the libcxx project from <a href="http://llvm.org" target="_blank">llvm.org</a> and installing the headers'"<br>
> +      "  echo 'into your build directory:'"<br>
> +      "  echo '  cd ${LLVM_SOURCE_DIR}/projects && svn co <a href="http://llvm.org/svn/llvm-project/libcxx/trunk" target="_blank">http://llvm.org/svn/llvm-project/libcxx/trunk</a> libcxx'"<br>
> +      "  echo '  cd ${LLVM_BINARY_DIR} && make -C ${LLVM_SOURCE_DIR}/projects/libcxx installheaders HEADER_DIR=${LLVM_BINARY_DIR}/include'"<br>
> +      "  echo"<br>
> +      "  false"<br>
> +      "fi"<br>
> +      )<br>
> +    add_custom_target(CompilerRTUnitTestCheckCxx<br>
> +      COMMAND bash -c "${CMD}"<br>
> +      COMMENT "Checking that just-built clang can find C++ headers..."<br>
> +      DEPENDS clang<br>
> +      VERBATIM)<br>
> +  endif()<br>
> +endmacro()<br>
><br>
> Modified: compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt?rev=217523&r1=217522&r2=217523&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt?rev=217523&r1=217522&r2=217523&view=diff</a><br>
> ==============================================================================<br>
> --- compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt (original)<br>
> +++ compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt Wed Sep 10 12:23:58 2014<br>
> @@ -1,5 +1,7 @@<br>
>  include(CompilerRTCompile)<br>
><br>
> +clang_compiler_add_cxx_check()<br>
> +<br>
>  set(SANITIZER_UNITTESTS<br>
>    sanitizer_allocator_test.cc<br>
>    sanitizer_atomic_test.cc<br>
><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>
<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
--<br>
Alexander Potapenko<br>
Software Engineer<br>
Google Moscow<br>
</font></span></blockquote></div><br></div>