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

Alexander Potapenko glider at google.com
Thu Sep 25 02:40:20 PDT 2014


Landed in r218444.

On Thu, Sep 25, 2014 at 1:25 PM, Alexander Potapenko <glider at google.com> wrote:
> I confirm this fixes the problem, will land your patch soon.
>
> On Thu, Sep 25, 2014 at 12:01 AM, Kuba Brecka <kuba.brecka at gmail.com> wrote:
>> Ok, I can reproduce this. This should fix it:
>>
>> Index: cmake/Modules/CompilerRTCompile.cmake
>> ===================================================================
>> --- cmake/Modules/CompilerRTCompile.cmake (revision 218404)
>> +++ cmake/Modules/CompilerRTCompile.cmake (working copy)
>> @@ -73,7 +73,9 @@
>>      add_custom_target(CompilerRTUnitTestCheckCxx
>>        COMMAND bash -c "${CMD}"
>>        COMMENT "Checking that just-built clang can find C++ headers..."
>> -      DEPENDS clang
>>        VERBATIM)
>> +    if (TARGET clang)
>> +      ADD_DEPENDENCIES(CompilerRTUnitTestCheckCxx clang)
>> +    endif()
>>    endif()
>>  endmacro()
>>
>>
>> Kuba
>>
>>
>> On Mon, Sep 22, 2014 at 5:42 AM, Alexander Potapenko <glider at google.com>
>> wrote:
>>>
>>> Yeah, see below:
>>>
>>> + cd compiler_rt_build
>>> + cmake -DCMAKE_BUILD_TYPE=Release
>>>
>>> -DCMAKE_C_COMPILER=/Users/buildbot/src/llvm-buildbot/slave/mac10.9-cmake/build/llvm_build64/bin/clang
>>>
>>> -DCMAKE_CXX_COMPILER=/Users/buildbot/src/llvm-buildbot/slave/mac10.9-cmake/build/llvm_build64/bin/clang++
>>> -DCOMPILER_RT_INCLUDE_TESTS=ON -DCOMPILER_RT_ENABLE_WERROR=ON
>>>
>>> -DLLVM_CONFIG_PATH=/Users/buildbot/src/llvm-buildbot/slave/mac10.9-cmake/build/llvm_build64/bin/llvm-config
>>>
>>> /Users/buildbot/src/llvm-buildbot/slave/mac10.9-cmake/build/llvm/projects/compiler-rt
>>> + cd compiler_rt_build
>>> + make -j8 check-all
>>>
>>> llvm_build64 is the newly built Clang.
>>>
>>> On Fri, Sep 19, 2014 at 10:27 PM, Kuba Brecka <kuba.brecka at gmail.com>
>>> wrote:
>>> > I'll try it. What way do you run the compiler-rt build? "cmake
>>> > /path/to/compiler-rt -DLLVM_CONFIG_PATH=/path/to/llvm-config" then
>>> > "make"?
>>> >
>>> > Kuba
>>> >
>>> >
>>> > On Fri, Sep 19, 2014 at 11:17 AM, Alexander Potapenko
>>> > <glider at google.com>
>>> > wrote:
>>> >>
>>> >> This looks sane, but I'll need to test when I'm back to the office.
>>> >>
>>> >> On Sep 19, 2014 10:09 PM, "Kuba Brecka" <kuba.brecka at gmail.com> wrote:
>>> >>>
>>> >>> Ok, then changing the
>>> >>>
>>> >>>     add_custom_target(CompilerRTUnitTestCheckCxx
>>> >>>           COMMAND bash -c "${CMD}"
>>> >>>           COMMENT "Checking that just-built clang can find C++
>>> >>> headers..."
>>> >>>           DEPENDS clang
>>> >>>           VERBATIM)
>>> >>>
>>> >>> into something like
>>> >>>
>>> >>>     add_custom_target(CompilerRTUnitTestCheckCxx
>>> >>>           COMMAND bash -c "${CMD}"
>>> >>>           COMMENT "Checking that just-built clang can find C++
>>> >>> headers..."
>>> >>>           VERBATIM)
>>> >>>     if(NOT COMPILER_RT_STANDALONE_BUILD)
>>> >>>       ADD_DEPENDENCIES(CompilerRTUnitTestCheckCxx clang)
>>> >>>     endif()
>>> >>>
>>> >>> should help, what do you think?
>>> >>>
>>> >>> Kuba
>>> >>>
>>> >>>
>>> >>> On Fri, Sep 19, 2014 at 10:55 AM, Alexander Potapenko
>>> >>> <glider at google.com>
>>> >>> wrote:
>>> >>>>
>>> >>>> Yes, using the freshly built Clang.
>>> >>>>
>>> >>>> On Sep 19, 2014 9:42 PM, "Kuba Brecka" <kuba.brecka at gmail.com> wrote:
>>> >>>>>
>>> >>>>> Are you building the compiler-rt project separately?
>>> >>>>>
>>> >>>>> Kuba
>>> >>>>>
>>> >>>>>
>>> >>>>> On Fri, Sep 19, 2014 at 9:10 AM, Alexander Potapenko
>>> >>>>> <glider at google.com> wrote:
>>> >>>>>>
>>> >>>>>> Here's the error message from that system:
>>> >>>>>>
>>> >>>>>> [100%] Built target compiler-rt-build
>>> >>>>>> make[7]: *** No rule to make target
>>> >>>>>>
>>> >>>>>>
>>> >>>>>> `/Users/buildbot/src/llvm-buildbot/slave/mac10.9-cmake/build/llvm/projects/compiler-rt/lib/sanitizer_common/tests/clang',
>>> >>>>>> needed by
>>> >>>>>> `lib/sanitizer_common/tests/CMakeFiles/CompilerRTUnitTestCheckCxx'.
>>> >>>>>> Stop.
>>> >>>>>> make[6]: ***
>>> >>>>>>
>>> >>>>>> [lib/sanitizer_common/tests/CMakeFiles/CompilerRTUnitTestCheckCxx.dir/all]
>>> >>>>>> Error 2
>>> >>>>>> make[6]: *** Waiting for unfinished jobs....
>>> >>>>>>
>>> >>>>>>
>>> >>>>>>
>>> >>>>>> On Thu, Sep 11, 2014 at 8:00 PM, Kuba Brecka
>>> >>>>>> <kuba.brecka at gmail.com>
>>> >>>>>> wrote:
>>> >>>>>> > Does the command that performs the check:
>>> >>>>>> >
>>> >>>>>> >   echo '#include <iostream>' | ./build/bin/clang -E -x c++ -
>>> >>>>>> >
>>> >>>>>> > fail on that system?
>>> >>>>>> >
>>> >>>>>> > Kuba
>>> >>>>>> >
>>> >>>>>> >
>>> >>>>>> > On Thu, Sep 11, 2014 at 8:52 AM, Alexander Potapenko
>>> >>>>>> > <glider at google.com>
>>> >>>>>> > wrote:
>>> >>>>>> >>
>>> >>>>>> >> OSX 10.9. Yes, this is a buildbot failure on our internal bot.
>>> >>>>>> >>
>>> >>>>>> >> On Thu, Sep 11, 2014 at 7:49 PM, Kuba Brecka
>>> >>>>>> >> <kuba.brecka at gmail.com>
>>> >>>>>> >> wrote:
>>> >>>>>> >> > Which version of Darwin? Is it a buildbot failure?
>>> >>>>>> >> >
>>> >>>>>> >> > If check-asan worked before and this patch broke it, then
>>> >>>>>> >> > please
>>> >>>>>> >> > revert.
>>> >>>>>> >> > Thanks.
>>> >>>>>> >> >
>>> >>>>>> >> > Kuba
>>> >>>>>> >> >
>>> >>>>>> >> >
>>> >>>>>> >> > On Thu, Sep 11, 2014 at 2:18 AM, Alexander Potapenko
>>> >>>>>> >> > <glider at google.com>
>>> >>>>>> >> > wrote:
>>> >>>>>> >> >>
>>> >>>>>> >> >> Apparently this broke `make check-asan` on Darwin.
>>> >>>>>> >> >> I'll check whether the problem can be fixed easily or revert
>>> >>>>>> >> >> otherwise.
>>> >>>>>> >> >>
>>> >>>>>> >> >> On Wed, Sep 10, 2014 at 9:23 PM, Kuba Brecka
>>> >>>>>> >> >> <kuba.brecka at gmail.com>
>>> >>>>>> >> >> wrote:
>>> >>>>>> >> >> > Author: kuba.brecka
>>> >>>>>> >> >> > Date: Wed Sep 10 12:23:58 2014
>>> >>>>>> >> >> > New Revision: 217523
>>> >>>>>> >> >> >
>>> >>>>>> >> >> > URL:
>>> >>>>>> >> >> > http://llvm.org/viewvc/llvm-project?rev=217523&view=rev
>>> >>>>>> >> >> > Log:
>>> >>>>>> >> >> > Make compiler-rt tests work with relocatable SDKs on OS X
>>> >>>>>> >> >> >
>>> >>>>>> >> >> > Reviewed at http://reviews.llvm.org/D4047
>>> >>>>>> >> >> >
>>> >>>>>> >> >> >
>>> >>>>>> >> >> > Modified:
>>> >>>>>> >> >> >     compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake
>>> >>>>>> >> >> >
>>> >>>>>> >> >> > compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt
>>> >>>>>> >> >> >
>>> >>>>>> >> >> > Modified:
>>> >>>>>> >> >> > compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake
>>> >>>>>> >> >> > URL:
>>> >>>>>> >> >> >
>>> >>>>>> >> >> >
>>> >>>>>> >> >> >
>>> >>>>>> >> >> > http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake?rev=217523&r1=217522&r2=217523&view=diff
>>> >>>>>> >> >> >
>>> >>>>>> >> >> >
>>> >>>>>> >> >> >
>>> >>>>>> >> >> >
>>> >>>>>> >> >> > ==============================================================================
>>> >>>>>> >> >> > --- compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake
>>> >>>>>> >> >> > (original)
>>> >>>>>> >> >> > +++ compiler-rt/trunk/cmake/Modules/CompilerRTCompile.cmake
>>> >>>>>> >> >> > Wed Sep
>>> >>>>>> >> >> > 10
>>> >>>>>> >> >> > 12:23:58 2014
>>> >>>>>> >> >> > @@ -11,6 +11,9 @@ macro(clang_compile object_file source)
>>> >>>>>> >> >> >    if(NOT COMPILER_RT_STANDALONE_BUILD)
>>> >>>>>> >> >> >      list(APPEND SOURCE_DEPS clang)
>>> >>>>>> >> >> >    endif()
>>> >>>>>> >> >> > +  if (TARGET CompilerRTUnitTestCheckCxx)
>>> >>>>>> >> >> > +    list(APPEND SOURCE_DEPS CompilerRTUnitTestCheckCxx)
>>> >>>>>> >> >> > +  endif()
>>> >>>>>> >> >> >    string(REGEX MATCH "[.](cc|cpp)$" is_cxx
>>> >>>>>> >> >> > ${source_rpath})
>>> >>>>>> >> >> >    if(is_cxx)
>>> >>>>>> >> >> >      string(REPLACE " " ";" global_flags
>>> >>>>>> >> >> > "${CMAKE_CXX_FLAGS}")
>>> >>>>>> >> >> > @@ -36,3 +39,41 @@ macro(clang_compile object_file source)
>>> >>>>>> >> >> >      MAIN_DEPENDENCY ${source}
>>> >>>>>> >> >> >      DEPENDS ${SOURCE_DEPS})
>>> >>>>>> >> >> >  endmacro()
>>> >>>>>> >> >> > +
>>> >>>>>> >> >> > +# On Darwin, there are no system-wide C++ headers and the
>>> >>>>>> >> >> > just-built
>>> >>>>>> >> >> > clang is
>>> >>>>>> >> >> > +# therefore not able to compile C++ files unless they are
>>> >>>>>> >> >> > copied/symlinked into
>>> >>>>>> >> >> > +# ${LLVM_BINARY_DIR}/include/c++
>>> >>>>>> >> >> > +# The just-built clang is used to build compiler-rt unit
>>> >>>>>> >> >> > tests.
>>> >>>>>> >> >> > Let's
>>> >>>>>> >> >> > detect
>>> >>>>>> >> >> > +# this before we try to build the tests and print out a
>>> >>>>>> >> >> > suggestion
>>> >>>>>> >> >> > how
>>> >>>>>> >> >> > to fix
>>> >>>>>> >> >> > +# it.
>>> >>>>>> >> >> > +# On other platforms, this is currently not an issue.
>>> >>>>>> >> >> > +macro(clang_compiler_add_cxx_check)
>>> >>>>>> >> >> > +  if (APPLE)
>>> >>>>>> >> >> > +    set(CMD
>>> >>>>>> >> >> > +      "echo '#include <iostream>' |
>>> >>>>>> >> >> > ${COMPILER_RT_TEST_COMPILER} -E
>>> >>>>>> >> >> > -x
>>> >>>>>> >> >> > c++ - > /dev/null"
>>> >>>>>> >> >> > +      "if [ $? != 0 ] "
>>> >>>>>> >> >> > +      "  then echo"
>>> >>>>>> >> >> > +      "  echo 'Your just-built clang cannot find C++
>>> >>>>>> >> >> > headers,
>>> >>>>>> >> >> > which
>>> >>>>>> >> >> > are
>>> >>>>>> >> >> > needed to build and run compiler-rt tests.'"
>>> >>>>>> >> >> > +      "  echo 'You should copy or symlink your system C++
>>> >>>>>> >> >> > headers
>>> >>>>>> >> >> > into
>>> >>>>>> >> >> > ${LLVM_BINARY_DIR}/include/c++'"
>>> >>>>>> >> >> > +      "  if [ -d $(dirname $(dirname $(xcrun -f
>>> >>>>>> >> >> > clang)))/include/c++
>>> >>>>>> >> >> > ]"
>>> >>>>>> >> >> > +      "    then echo 'e.g. with:'"
>>> >>>>>> >> >> > +      "    echo '  cp -r' $(dirname $(dirname $(xcrun -f
>>> >>>>>> >> >> > clang)))/include/c++ '${LLVM_BINARY_DIR}/include/'"
>>> >>>>>> >> >> > +      "  elif [ -d $(dirname $(dirname $(xcrun -f
>>> >>>>>> >> >> > clang)))/lib/c++
>>> >>>>>> >> >> > ]"
>>> >>>>>> >> >> > +      "    then echo 'e.g. with:'"
>>> >>>>>> >> >> > +      "    echo '  cp -r' $(dirname $(dirname $(xcrun -f
>>> >>>>>> >> >> > clang)))/lib/c++ '${LLVM_BINARY_DIR}/include/'"
>>> >>>>>> >> >> > +      "  fi"
>>> >>>>>> >> >> > +      "  echo 'This can also be fixed by checking out the
>>> >>>>>> >> >> > libcxx
>>> >>>>>> >> >> > project from llvm.org and installing the headers'"
>>> >>>>>> >> >> > +      "  echo 'into your build directory:'"
>>> >>>>>> >> >> > +      "  echo '  cd ${LLVM_SOURCE_DIR}/projects && svn co
>>> >>>>>> >> >> > http://llvm.org/svn/llvm-project/libcxx/trunk libcxx'"
>>> >>>>>> >> >> > +      "  echo '  cd ${LLVM_BINARY_DIR} && make -C
>>> >>>>>> >> >> > ${LLVM_SOURCE_DIR}/projects/libcxx installheaders
>>> >>>>>> >> >> > HEADER_DIR=${LLVM_BINARY_DIR}/include'"
>>> >>>>>> >> >> > +      "  echo"
>>> >>>>>> >> >> > +      "  false"
>>> >>>>>> >> >> > +      "fi"
>>> >>>>>> >> >> > +      )
>>> >>>>>> >> >> > +    add_custom_target(CompilerRTUnitTestCheckCxx
>>> >>>>>> >> >> > +      COMMAND bash -c "${CMD}"
>>> >>>>>> >> >> > +      COMMENT "Checking that just-built clang can find C++
>>> >>>>>> >> >> > headers..."
>>> >>>>>> >> >> > +      DEPENDS clang
>>> >>>>>> >> >> > +      VERBATIM)
>>> >>>>>> >> >> > +  endif()
>>> >>>>>> >> >> > +endmacro()
>>> >>>>>> >> >> >
>>> >>>>>> >> >> > Modified:
>>> >>>>>> >> >> > compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt
>>> >>>>>> >> >> > URL:
>>> >>>>>> >> >> >
>>> >>>>>> >> >> >
>>> >>>>>> >> >> >
>>> >>>>>> >> >> > http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt?rev=217523&r1=217522&r2=217523&view=diff
>>> >>>>>> >> >> >
>>> >>>>>> >> >> >
>>> >>>>>> >> >> >
>>> >>>>>> >> >> >
>>> >>>>>> >> >> > ==============================================================================
>>> >>>>>> >> >> > ---
>>> >>>>>> >> >> > compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt
>>> >>>>>> >> >> > (original)
>>> >>>>>> >> >> > +++
>>> >>>>>> >> >> > compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt
>>> >>>>>> >> >> > Wed
>>> >>>>>> >> >> > Sep
>>> >>>>>> >> >> > 10 12:23:58 2014
>>> >>>>>> >> >> > @@ -1,5 +1,7 @@
>>> >>>>>> >> >> >  include(CompilerRTCompile)
>>> >>>>>> >> >> >
>>> >>>>>> >> >> > +clang_compiler_add_cxx_check()
>>> >>>>>> >> >> > +
>>> >>>>>> >> >> >  set(SANITIZER_UNITTESTS
>>> >>>>>> >> >> >    sanitizer_allocator_test.cc
>>> >>>>>> >> >> >    sanitizer_atomic_test.cc
>>> >>>>>> >> >> >
>>> >>>>>> >> >> >
>>> >>>>>> >> >> > _______________________________________________
>>> >>>>>> >> >> > llvm-commits mailing list
>>> >>>>>> >> >> > llvm-commits at cs.uiuc.edu
>>> >>>>>> >> >> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>> >>>>>> >> >>
>>> >>>>>> >> >>
>>> >>>>>> >> >>
>>> >>>>>> >> >> --
>>> >>>>>> >> >> Alexander Potapenko
>>> >>>>>> >> >> Software Engineer
>>> >>>>>> >> >> Google Moscow
>>> >>>>>> >> >
>>> >>>>>> >> >
>>> >>>>>> >>
>>> >>>>>> >>
>>> >>>>>> >>
>>> >>>>>> >> --
>>> >>>>>> >> Alexander Potapenko
>>> >>>>>> >> Software Engineer
>>> >>>>>> >> Google Moscow
>>> >>>>>> >
>>> >>>>>> >
>>> >>>>>>
>>> >>>>>>
>>> >>>>>>
>>> >>>>>> --
>>> >>>>>> Alexander Potapenko
>>> >>>>>> Software Engineer
>>> >>>>>> Google Moscow
>>> >>>>>
>>> >>>>>
>>> >>>
>>> >
>>>
>>>
>>>
>>> --
>>> Alexander Potapenko
>>> Software Engineer
>>> Google Moscow
>>
>>
>
>
>
> --
> Alexander Potapenko
> Software Engineer
> Google Moscow



-- 
Alexander Potapenko
Software Engineer
Google Moscow



More information about the llvm-commits mailing list