From 5519100f79bfbfd8b6aa750511cd25de906c7162 Mon Sep 17 00:00:00 2001 From: Tao Sang Date: Mon, 18 May 2020 16:17:34 -0400 Subject: [PATCH] Fix square build failure with static lib in Jenkin When libamdhip64_static.a is built by Jenkin, sample square cannot been built successfully because libamdhip64_static.a is archiveved in thin mode. Thus in the patch it will be archiveved in full mode. Meanwhile libamdhip64_static_temp.a will be useless and thus removed. Change-Id: Ifd3882598ef0dc5e7af8db0e389e786025ceb455 [ROCm/clr commit: 51b6c1856c89098536f292b02fa90bbdcaaaaedf] --- projects/clr/hipamd/rocclr/CMakeLists.txt | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/projects/clr/hipamd/rocclr/CMakeLists.txt b/projects/clr/hipamd/rocclr/CMakeLists.txt index a6f918705a..2edcdabb55 100644 --- a/projects/clr/hipamd/rocclr/CMakeLists.txt +++ b/projects/clr/hipamd/rocclr/CMakeLists.txt @@ -203,17 +203,6 @@ set_target_properties(hip64 PROPERTIES PUBLIC_HEADER ${PROF_API_STR}) set_target_properties(amdhip64 PROPERTIES PUBLIC_HEADER ${PROF_API_STR}) set_target_properties(amdhip64_static PROPERTIES PUBLIC_HEADER ${PROF_API_STR}) - - -# We expect amdhip64_static to contain objects of rocclr and hip. But linker -# let amdhip64_static contain objects of hip only. So we will use a -# a custom amdhip64_static_combiner to combine objects of vid and hip into -# amdhip64_static. To avoid amdhip64_static contains itself, -# amdhip64_static_temp is created internally. -add_library(amdhip64_static_temp STATIC - $ - ) - add_library(host INTERFACE) target_link_libraries(host INTERFACE amdhip64) add_library(device INTERFACE) @@ -225,19 +214,19 @@ target_link_libraries(device INTERFACE host) # filename. target_link_libraries(amdhip64 PRIVATE amdrocclr_static Threads::Threads dl) target_link_libraries(amdhip64_static PRIVATE Threads::Threads dl) -target_link_libraries(amdhip64_static_temp PRIVATE Threads::Threads dl) # combine objects of vid and hip into amdhip64_static add_custom_target( amdhip64_static_combiner ALL - COMMAND rm -f $ # Must remove old one, otherwise the new one will contain obsolete stuff - COMMAND ${CMAKE_AR} -rcsT $ $ $ - DEPENDS amdhip64_static amdhip64_static_temp amdrocclr_static # To make sure this is the last step + COMMAND rm -rf static_lib_temp && mkdir static_lib_temp && cd static_lib_temp # Create temp folder to contain *.o + COMMAND ${CMAKE_AR} -x $ # Extract *.o from amdrocclr_static + COMMAND ${CMAKE_AR} -rcs $ *.o # Append *.o to amdhip64_static + COMMAND cd .. && rm -rf static_lib_temp # Remove temp folder + DEPENDS amdhip64_static amdrocclr_static # To make sure this is the last step COMMENT "Combining static libs into amdhip64_static" ) - INSTALL(PROGRAMS $ DESTINATION lib COMPONENT MAIN) INSTALL(PROGRAMS $ DESTINATION lib COMPONENT MAIN) INSTALL(CODE "execute_process( COMMAND ${CMAKE_COMMAND} -E create_symlink libamdhip64.so lib/libhip_hcc.so )" DESTINATION lib COMPONENT MAIN)