[compiler-rt] r329776 - [XRay][compiler-rt] Fix osx-based builds

George Karpenkov via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 11 11:05:28 PDT 2018


Hi Dean,

I have fixed the build failure in r329832. 

In general, do you think it would be possible to perform the task using higher-level functions available from AddCompilerRT.cmake?
They were written exactly to avoid such errors.

Regards,
George

> On Apr 11, 2018, at 10:50 AM, George Karpenkov <ekarpenkov at apple.com> wrote:
> 
> Hi Dean,
> 
> For me the build is still broken:
> 
> -- Builtin supported architectures: i386;x86_64;x86_64h
> CMake Error at projects/compiler-rt/lib/xray/tests/CMakeLists.txt:21 (add_library):
>  add_library cannot create target "RTXRay.test.osx" because another target
>  with the same name already exists.  The existing target is a static library
>  created in source directory
>  "/Volumes/Transcend/code/llvm/projects/compiler-rt/lib/xray/tests".  See
>  documentation for policy CMP0002 for more details.
> Call Stack (most recent call first):
>  projects/compiler-rt/lib/xray/tests/CMakeLists.txt:73 (add_xray_lib)
> 
> Do you think you could take a look?
> 
> Regards,
> George
> 
>> On Apr 10, 2018, at 10:16 PM, Dean Michael Berris via llvm-commits <llvm-commits at lists.llvm.org> wrote:
>> 
>> Author: dberris
>> Date: Tue Apr 10 22:16:11 2018
>> New Revision: 329776
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=329776&view=rev
>> Log:
>> [XRay][compiler-rt] Fix osx-based builds
>> 
>> This is a follow-up to D45474.
>> 
>> Modified:
>>   compiler-rt/trunk/lib/xray/tests/CMakeLists.txt
>> 
>> Modified: compiler-rt/trunk/lib/xray/tests/CMakeLists.txt
>> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/tests/CMakeLists.txt?rev=329776&r1=329775&r2=329776&view=diff
>> ==============================================================================
>> --- compiler-rt/trunk/lib/xray/tests/CMakeLists.txt (original)
>> +++ compiler-rt/trunk/lib/xray/tests/CMakeLists.txt Tue Apr 10 22:16:11 2018
>> @@ -34,13 +34,18 @@ function(get_xray_lib_for_arch arch lib)
>> endfunction()
>> 
>> set(XRAY_TEST_ARCH ${XRAY_SUPPORTED_ARCH})
>> +set(XRAY_UNITTEST_LINK_FLAGS ${CMAKE_THREAD_LIBS_INIT})
>> +if (NOT APPLE)
>> +  append_list_if(COMPILER_RT_HAS_LIBM -lm XRAY_UNITTEST_LINK_FLAGS)
>> +  append_list_if(COMPILER_RT_HAS_LIBRT -lrt XRAY_UNITTEST_LINK_FLAGS)
>> +  append_list_if(COMPILER_RT_HAS_LIBDL -ldl XRAY_UNITTEST_LINK_FLAGS)
>> +  append_list_if(COMPILER_RT_HAS_LIBPTHREAD -pthread XRAY_UNITTEST_LINK_FLAGS)
>> +endif()
>> +
>> macro(add_xray_unittest testname)
>>  cmake_parse_arguments(TEST "" "" "SOURCES;HEADERS" ${ARGN})
>>  if(UNIX AND NOT APPLE)
>>    set(CMAKE_DL_LIBS_INIT "")
>> -    foreach(lib ${CMAKE_DL_LIBS})
>> -      list(APPEND CMAKE_DL_LIBS_INIT -l${lib})
>> -    endforeach()
>>    foreach(arch ${XRAY_TEST_ARCH})
>>      set(TEST_OBJECTS)
>>      get_xray_lib_for_arch(${arch} XRAY_RUNTIME_LIBS)
>> @@ -55,9 +60,7 @@ macro(add_xray_unittest testname)
>>        RUNTIME "${XRAY_RUNTIME_LIBS}"
>>        DEPS gtest xray
>>        CFLAGS ${XRAY_UNITTEST_CFLAGS}
>> -        LINK_FLAGS ${TARGET_LINK_FLAGS}
>> -          -lstdc++ -lm ${CMAKE_THREAD_LIBS_INIT}
>> -          ${CMAKE_DL_LIBS_INIT} -lrt)
>> +        LINK_FLAGS ${TARGET_LINK_FLAGS} ${XRAY_UNITTEST_LINK_FLAGS} -lstdc++)
>>      set_target_properties(XRayUnitTests
>>        PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
>>    endforeach()
>> @@ -66,11 +69,19 @@ endmacro()
>> 
>> if(COMPILER_RT_CAN_EXECUTE_TESTS)
>>  foreach(arch ${XRAY_SUPPORTED_ARCH})
>> -    add_xray_lib("RTXRay.test.${arch}"
>> -      $<TARGET_OBJECTS:RTXray.${arch}>
>> -      $<TARGET_OBJECTS:RTXrayFDR.${arch}>
>> -      $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
>> -      $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>)
>> +    if (APPLE)
>> +      add_xray_lib("RTXRay.test.osx"
>> +        $<TARGET_OBJECTS:RTXray.osx>
>> +        $<TARGET_OBJECTS:RTXrayFDR.osx>
>> +        $<TARGET_OBJECTS:RTSanitizerCommon.osx>
>> +        $<TARGET_OBJECTS:RTSanitizerCommonLibc.osx>)
>> +    else()
>> +      add_xray_lib("RTXRay.test.${arch}"
>> +        $<TARGET_OBJECTS:RTXray.${arch}>
>> +        $<TARGET_OBJECTS:RTXrayFDR.${arch}>
>> +        $<TARGET_OBJECTS:RTSanitizerCommon.${arch}>
>> +        $<TARGET_OBJECTS:RTSanitizerCommonLibc.${arch}>)
>> +    endif()
>>  endforeach()
>>  add_subdirectory(unit)
>> endif()
>> 
>> 
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> 



More information about the llvm-commits mailing list