George Karpenkov via llvm-dev
2018-Apr-11 17:50 UTC
[llvm-dev] [compiler-rt] r329776 - [XRay][compiler-rt] Fix osx-based builds
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
George Karpenkov via llvm-dev
2018-Apr-11 18:05 UTC
[llvm-dev] [compiler-rt] r329776 - [XRay][compiler-rt] Fix osx-based builds
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 >
Dean Michael Berris via llvm-dev
2018-Apr-12 00:06 UTC
[llvm-dev] [compiler-rt] r329776 - [XRay][compiler-rt] Fix osx-based builds
Ouch. Sorry about that, George. I definitely think the XRay CMake configurations should be using as many re-usable functions as possible, if they already exist. Unfortunately am not well-versed enough about what's in AddCompilerRT.cmake and/or what CMake already does. :( This is mostly cargo-culting from surrounding CMake configs, and me crossing fingers to hope that things aren't that broken in platforms I don't regularly test/build with. All the help in cleaning this up would be greatly appreciated. On Thu, Apr 12, 2018 at 4:05 AM George Karpenkov <ekarpenkov at apple.com> wrote:> 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 > > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180412/c96a6374/attachment.html>
Maybe Matching Threads
- [compiler-rt] r329776 - [XRay][compiler-rt] Fix osx-based builds
- [Release-testers] [8.0.0 Release] rc1 has been tagged
- Upgrading LLVM's minimum required CMake version
- Upgrading LLVM's minimum required CMake version
- Upgrading LLVM's minimum required CMake version