From c56e84e4dfc604a69e77d6f6cf14cd8a38d1b90f Mon Sep 17 00:00:00 2001 From: Jan Vorlicek Date: Thu, 26 Mar 2020 13:29:24 -0700 Subject: [PATCH 1/3] Fix debug symbol generation The debug symbol generation got recently broken. For most of the shared libraries, the debug symbols were stripped twice due to the fact that install_clr for them was invoked twice - once for the default install location and once for the sharedFramework location and the stripping was executed in both of them. First stripping stripped the symbols off the target binary and set so called debuglink in the binary to point to the symbol file. This debuglink includes a crc32 of the dbg symbols file. The second stripping tried to strip symbols from the already stripped binary. That resulted in a small dbg symbols file that didn't actually contain any useful symbols. Moreover, it is not possible to set a debuglink in a binary if it is already set there. So the second attempt failed and the crc was left set to the crc of the previous debug. Thus when debugger loads such a binary, it cannot find the debug symbols file, as the crc doesn't match. And even if it matched, the data would have no value. The fix is to modify install_clr so that it has an extra optional argument to specify the secondary install location and use just one install_clr per target. The function then does the stripping just once and the actual installation once or twice depending on the secondary location argumenbt presence. --- eng/native/functions.cmake | 45 ++++++++++--------- .../src/debug/createdump/CMakeLists.txt | 3 +- src/coreclr/src/dlls/clretwrc/CMakeLists.txt | 3 +- src/coreclr/src/dlls/dbgshim/CMakeLists.txt | 3 +- src/coreclr/src/dlls/mscordac/CMakeLists.txt | 3 +- src/coreclr/src/dlls/mscordbi/CMakeLists.txt | 3 +- .../src/dlls/mscoree/coreclr/CMakeLists.txt | 3 +- src/coreclr/src/dlls/mscorrc/CMakeLists.txt | 3 +- src/coreclr/src/jit/CMakeLists.txt | 3 +- src/coreclr/src/jit/standalone/CMakeLists.txt | 5 +-- .../lttngprovider/CMakeLists.txt | 3 +- src/coreclr/src/tools/crossgen/CMakeLists.txt | 3 +- 12 files changed, 37 insertions(+), 43 deletions(-) diff --git a/eng/native/functions.cmake b/eng/native/functions.cmake index bd96bc9c599d8b..abdb3910e7c507 100644 --- a/eng/native/functions.cmake +++ b/eng/native/functions.cmake @@ -291,22 +291,22 @@ function(strip_symbols targetName outputFilename) endif (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_IOS) set(${outputFilename} ${strip_destination_file} PARENT_SCOPE) + else(CLR_CMAKE_HOST_UNIX) + set(${outputFilename} ${CMAKE_CURRENT_BINARY_DIR}/$/${targetName}.pdb PARENT_SCOPE) endif(CLR_CMAKE_HOST_UNIX) endfunction() -function(install_symbols targetName destination_path) - strip_symbols(${targetName} strip_destination_file) - +function(install_symbols symbol_file destination_path) if(CLR_CMAKE_TARGET_WIN32) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$/${targetName}.pdb DESTINATION ${destination_path}/PDB) + install(FILES ${symbol_file} DESTINATION ${destination_path}/PDB) else() - install(FILES ${strip_destination_file} DESTINATION ${destination_path}) + install(FILES ${symbol_file} DESTINATION ${destination_path}) endif() endfunction() -# install_clr(TARGETS TARGETS targetName [targetName2 ...] [DESTINATION destination]) +# install_clr(TARGETS TARGETS targetName [targetName2 ...] [ADDITIONAL_DESTINATION destination]) function(install_clr) - set(oneValueArgs DESTINATION) + set(oneValueArgs ADDITIONAL_DESTINATION) set(multiValueArgs TARGETS) cmake_parse_arguments(PARSE_ARGV 0 INSTALL_CLR "${options}" "${oneValueArgs}" "${multiValueArgs}") @@ -314,24 +314,29 @@ function(install_clr) message(FATAL_ERROR "At least one target must be passed to install_clr(TARGETS )") endif() - if ("${INSTALL_CLR_DESTINATION}" STREQUAL "") - set(INSTALL_CLR_DESTINATION ".") + set(destinations ".") + + if (NOT "${INSTALL_CLR_ADDITIONAL_DESTINATION}" STREQUAL "") + list(APPEND destinations ${INSTALL_CLR_ADDITIONAL_DESTINATION}) endif() foreach(targetName ${INSTALL_CLR_TARGETS}) list(FIND CLR_CROSS_COMPONENTS_LIST ${targetName} INDEX) if (NOT DEFINED CLR_CROSS_COMPONENTS_LIST OR NOT ${INDEX} EQUAL -1) - install_symbols(${targetName} ${INSTALL_CLR_DESTINATION}) - - # We don't need to install the export libraries for our DLLs - # since they won't be directly linked against. - install(PROGRAMS $ DESTINATION ${INSTALL_CLR_DESTINATION}) - - if(CLR_CMAKE_PGO_INSTRUMENT) - if(WIN32) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$/${targetName}.pgd DESTINATION ${INSTALL_CLR_DESTINATION}/PGD OPTIONAL) - endif() - endif() + strip_symbols(${targetName} symbol_file) + + foreach(destination in ${destinations}) + # We don't need to install the export libraries for our DLLs + # since they won't be directly linked against. + install(PROGRAMS $ DESTINATION ${destination}) + install_symbols(${symbol_file} ${destination}) + + if(CLR_CMAKE_PGO_INSTRUMENT) + if(WIN32) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$/${targetName}.pgd DESTINATION ${destination}/PGD OPTIONAL) + endif() + endif() + endforeach() endif() endforeach() endfunction() diff --git a/src/coreclr/src/debug/createdump/CMakeLists.txt b/src/coreclr/src/debug/createdump/CMakeLists.txt index fc5fff69c3f200..f642159fb705ba 100644 --- a/src/coreclr/src/debug/createdump/CMakeLists.txt +++ b/src/coreclr/src/debug/createdump/CMakeLists.txt @@ -51,5 +51,4 @@ target_link_libraries(createdump add_dependencies(createdump mscordaccore) -install_clr(TARGETS createdump) -install_clr(TARGETS createdump DESTINATION sharedFramework) +install_clr(TARGETS createdump ADDITIONAL_DESTINATION sharedFramework) diff --git a/src/coreclr/src/dlls/clretwrc/CMakeLists.txt b/src/coreclr/src/dlls/clretwrc/CMakeLists.txt index 7ef540fa3c8274..9935362c0c9a9b 100644 --- a/src/coreclr/src/dlls/clretwrc/CMakeLists.txt +++ b/src/coreclr/src/dlls/clretwrc/CMakeLists.txt @@ -20,7 +20,6 @@ add_library_clr(clretwrc SHARED ) # add the install targets -install_clr(TARGETS clretwrc) -install_clr(TARGETS clretwrc DESTINATION sharedFramework) +install_clr(TARGETS clretwrc ADDITIONAL_DESTINATION sharedFramework) add_dependencies(clretwrc eventing_headers) diff --git a/src/coreclr/src/dlls/dbgshim/CMakeLists.txt b/src/coreclr/src/dlls/dbgshim/CMakeLists.txt index 566dc4084943c8..19bb217ccf16d2 100644 --- a/src/coreclr/src/dlls/dbgshim/CMakeLists.txt +++ b/src/coreclr/src/dlls/dbgshim/CMakeLists.txt @@ -83,5 +83,4 @@ endif(CLR_CMAKE_HOST_WIN32) target_link_libraries(dbgshim ${DBGSHIM_LIBRARIES}) # add the install targets -install_clr(TARGETS dbgshim) -install_clr(TARGETS dbgshim DESTINATION sharedFramework) +install_clr(TARGETS dbgshim ADDITIONAL_DESTINATION sharedFramework) diff --git a/src/coreclr/src/dlls/mscordac/CMakeLists.txt b/src/coreclr/src/dlls/mscordac/CMakeLists.txt index c5d44215891325..3758dbede2274b 100644 --- a/src/coreclr/src/dlls/mscordac/CMakeLists.txt +++ b/src/coreclr/src/dlls/mscordac/CMakeLists.txt @@ -188,8 +188,7 @@ endif(CLR_CMAKE_HOST_WIN32) target_link_libraries(mscordaccore PRIVATE ${COREDAC_LIBRARIES}) # add the install targets -install_clr(TARGETS mscordaccore) -install_clr(TARGETS mscordaccore DESTINATION sharedFramework) +install_clr(TARGETS mscordaccore ADDITIONAL_DESTINATION sharedFramework) if(CLR_CMAKE_HOST_WIN32) set(LONG_NAME_HOST_ARCH ${CLR_CMAKE_HOST_ARCH}) diff --git a/src/coreclr/src/dlls/mscordbi/CMakeLists.txt b/src/coreclr/src/dlls/mscordbi/CMakeLists.txt index f125c0b8226a49..236bc800936ca9 100644 --- a/src/coreclr/src/dlls/mscordbi/CMakeLists.txt +++ b/src/coreclr/src/dlls/mscordbi/CMakeLists.txt @@ -118,5 +118,4 @@ elseif(CLR_CMAKE_HOST_UNIX) endif(CLR_CMAKE_HOST_WIN32) # add the install targets -install_clr(TARGETS mscordbi) -install_clr(TARGETS mscordbi DESTINATION sharedFramework) +install_clr(TARGETS mscordbi ADDITIONAL_DESTINATION sharedFramework) diff --git a/src/coreclr/src/dlls/mscoree/coreclr/CMakeLists.txt b/src/coreclr/src/dlls/mscoree/coreclr/CMakeLists.txt index 34e544404fb960..4303afca886c0c 100644 --- a/src/coreclr/src/dlls/mscoree/coreclr/CMakeLists.txt +++ b/src/coreclr/src/dlls/mscoree/coreclr/CMakeLists.txt @@ -213,8 +213,7 @@ if(CLR_CMAKE_TARGET_WIN32) endif(CLR_CMAKE_TARGET_WIN32) # add the install targets -install_clr(TARGETS coreclr) -install_clr(TARGETS coreclr DESTINATION sharedFramework) +install_clr(TARGETS coreclr ADDITIONAL_DESTINATION sharedFramework) # Enable profile guided optimization add_pgo(coreclr) diff --git a/src/coreclr/src/dlls/mscorrc/CMakeLists.txt b/src/coreclr/src/dlls/mscorrc/CMakeLists.txt index ab6a5a231094da..08cf27aaf8020d 100644 --- a/src/coreclr/src/dlls/mscorrc/CMakeLists.txt +++ b/src/coreclr/src/dlls/mscorrc/CMakeLists.txt @@ -15,8 +15,7 @@ if(CLR_CMAKE_HOST_WIN32) include.rc ) - install_clr(TARGETS mscorrc) - install_clr(TARGETS mscorrc DESTINATION sharedFramework) + install_clr(TARGETS mscorrc ADDITIONAL_DESTINATION sharedFramework) else() build_resources(${CMAKE_CURRENT_SOURCE_DIR}/include.rc mscorrc TARGET_CPP_FILE) diff --git a/src/coreclr/src/jit/CMakeLists.txt b/src/coreclr/src/jit/CMakeLists.txt index 910fcaa950f2f8..75be5d00eb0b1f 100644 --- a/src/coreclr/src/jit/CMakeLists.txt +++ b/src/coreclr/src/jit/CMakeLists.txt @@ -359,6 +359,7 @@ else() endif(CLR_CMAKE_HOST_UNIX) # Shared function for generating JIT +# optional arguments: ADDITIONAL_DESTINATION path function(add_jit jitName) if(CLR_CMAKE_TARGET_WIN32) add_definitions(-DFX_VER_INTERNALNAME_STR=${jitName}.dll) @@ -385,7 +386,7 @@ function(add_jit jitName) ) # add the install targets - install_clr(TARGETS ${jitName}) + install_clr(TARGETS ${jitName} ${ARGN}) endfunction() set(JIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/src/coreclr/src/jit/standalone/CMakeLists.txt b/src/coreclr/src/jit/standalone/CMakeLists.txt index fa10b2ab591e72..c37ed9c31b5517 100644 --- a/src/coreclr/src/jit/standalone/CMakeLists.txt +++ b/src/coreclr/src/jit/standalone/CMakeLists.txt @@ -8,10 +8,7 @@ if(FEATURE_READYTORUN) add_definitions(-DFEATURE_READYTORUN_COMPILER) endif(FEATURE_READYTORUN) -add_jit(clrjit) - -# add the install targets -install_clr(TARGETS clrjit DESTINATION sharedFramework) +add_jit(clrjit ADDITIONAL_DESTINATION sharedFramework) # Enable profile guided optimization add_pgo(clrjit) diff --git a/src/coreclr/src/pal/src/eventprovider/lttngprovider/CMakeLists.txt b/src/coreclr/src/pal/src/eventprovider/lttngprovider/CMakeLists.txt index 874a457db28792..234dea19b753db 100644 --- a/src/coreclr/src/pal/src/eventprovider/lttngprovider/CMakeLists.txt +++ b/src/coreclr/src/pal/src/eventprovider/lttngprovider/CMakeLists.txt @@ -71,5 +71,4 @@ set_target_properties(coreclrtraceptprovider PROPERTIES LINKER_LANGUAGE CXX) # Install the static eventprovider library _install(TARGETS eventprovider DESTINATION lib) # Install the static coreclrtraceptprovider library -install_clr(TARGETS coreclrtraceptprovider) -install_clr(TARGETS coreclrtraceptprovider DESTINATION sharedFramework) +install_clr(TARGETS coreclrtraceptprovider ADDITIONAL_DESTINATION sharedFramework) diff --git a/src/coreclr/src/tools/crossgen/CMakeLists.txt b/src/coreclr/src/tools/crossgen/CMakeLists.txt index f8cd5b0bf12de1..a8a4629a654206 100644 --- a/src/coreclr/src/tools/crossgen/CMakeLists.txt +++ b/src/coreclr/src/tools/crossgen/CMakeLists.txt @@ -81,5 +81,4 @@ add_subdirectory(../../zap ../../zap) add_subdirectory(../../vm/crossgen ../../vm/crossgen) # add the install targets -install_clr(TARGETS crossgen) -install_clr(TARGETS crossgen DESTINATION sharedFramework) +install_clr(TARGETS crossgen ADDITIONAL_DESTINATION sharedFramework) From ebbd2cac822ca5863b1db27e2ae46dd2ef692733 Mon Sep 17 00:00:00 2001 From: Jan Vorlicek Date: Thu, 26 Mar 2020 18:39:36 -0700 Subject: [PATCH 2/3] Fix libraries and installer --- eng/native/functions.cmake | 7 +++++++ src/installer/corehost/cli/comhost/CMakeLists.txt | 3 +-- src/installer/corehost/cli/exe.cmake | 3 +-- src/installer/corehost/cli/fxr/CMakeLists.txt | 3 +-- src/installer/corehost/cli/hostpolicy/CMakeLists.txt | 3 +-- src/installer/corehost/cli/ijwhost/CMakeLists.txt | 3 +-- src/installer/corehost/cli/nethost/CMakeLists.txt | 3 +-- src/installer/corehost/cli/test/mockcoreclr/CMakeLists.txt | 3 +-- src/installer/corehost/cli/test/mockhostfxr/CMakeLists.txt | 3 +-- .../corehost/cli/test/mockhostpolicy/CMakeLists.txt | 3 +-- src/installer/corehost/cli/test/testexe.cmake | 3 +-- src/installer/corehost/cli/winrthost/CMakeLists.txt | 3 +-- src/libraries/Native/Unix/CMakeLists.txt | 4 +--- 13 files changed, 19 insertions(+), 25 deletions(-) diff --git a/eng/native/functions.cmake b/eng/native/functions.cmake index abdb3910e7c507..ae79d15e45c33c 100644 --- a/eng/native/functions.cmake +++ b/eng/native/functions.cmake @@ -296,6 +296,13 @@ function(strip_symbols targetName outputFilename) endif(CLR_CMAKE_HOST_UNIX) endfunction() +function(install_with_stripped_symbols targetName destination) + strip_symbols(${targetName} symbol_file) + install_symbols(${symbol_file} ${destination}) + set(install_source_file $) + install(PROGRAMS ${install_source_file} DESTINATION ${destination}) +endfunction() + function(install_symbols symbol_file destination_path) if(CLR_CMAKE_TARGET_WIN32) install(FILES ${symbol_file} DESTINATION ${destination_path}/PDB) diff --git a/src/installer/corehost/cli/comhost/CMakeLists.txt b/src/installer/corehost/cli/comhost/CMakeLists.txt index edbf3e77ea283b..4fe7d1a0692a1b 100644 --- a/src/installer/corehost/cli/comhost/CMakeLists.txt +++ b/src/installer/corehost/cli/comhost/CMakeLists.txt @@ -42,6 +42,5 @@ if (CLR_CMAKE_TARGET_WIN32) target_link_libraries(comhost ${WINLIBS}) endif() -install(TARGETS comhost DESTINATION corehost) -install_symbols(comhost corehost) +install_with_stripped_symbols(comhost corehost) target_link_libraries(comhost libhostcommon) diff --git a/src/installer/corehost/cli/exe.cmake b/src/installer/corehost/cli/exe.cmake index 3728e05ff2014f..67852d15d00b82 100644 --- a/src/installer/corehost/cli/exe.cmake +++ b/src/installer/corehost/cli/exe.cmake @@ -25,7 +25,6 @@ if(NOT CLR_CMAKE_TARGET_WIN32) disable_pax_mprotect(${DOTNET_PROJECT_NAME}) endif() -install(TARGETS ${DOTNET_PROJECT_NAME} DESTINATION corehost) -install_symbols(${DOTNET_PROJECT_NAME} corehost) +install_with_stripped_symbols(${DOTNET_PROJECT_NAME} corehost) set_common_libs("exe") diff --git a/src/installer/corehost/cli/fxr/CMakeLists.txt b/src/installer/corehost/cli/fxr/CMakeLists.txt index 3e14083a919e31..e22eecae6ee050 100644 --- a/src/installer/corehost/cli/fxr/CMakeLists.txt +++ b/src/installer/corehost/cli/fxr/CMakeLists.txt @@ -43,6 +43,5 @@ set(HEADERS include(../lib.cmake) -install(TARGETS hostfxr DESTINATION corehost) -install_symbols(hostfxr corehost) +install_with_stripped_symbols(hostfxr corehost) target_link_libraries(hostfxr libhostcommon) diff --git a/src/installer/corehost/cli/hostpolicy/CMakeLists.txt b/src/installer/corehost/cli/hostpolicy/CMakeLists.txt index b19c743bf76efc..d67a109a1c705e 100644 --- a/src/installer/corehost/cli/hostpolicy/CMakeLists.txt +++ b/src/installer/corehost/cli/hostpolicy/CMakeLists.txt @@ -34,6 +34,5 @@ set(HEADERS include(../lib.cmake) -install(TARGETS hostpolicy DESTINATION corehost) -install_symbols(hostpolicy corehost) +install_with_stripped_symbols(hostpolicy corehost) target_link_libraries(hostpolicy libhostcommon) diff --git a/src/installer/corehost/cli/ijwhost/CMakeLists.txt b/src/installer/corehost/cli/ijwhost/CMakeLists.txt index 7174983993bafc..d13e94928b2e31 100644 --- a/src/installer/corehost/cli/ijwhost/CMakeLists.txt +++ b/src/installer/corehost/cli/ijwhost/CMakeLists.txt @@ -51,5 +51,4 @@ if (CLR_CMAKE_TARGET_WIN32 AND (CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_AR target_link_libraries(ijwhost Advapi32.lib Ole32.lib) endif() -install(TARGETS ijwhost DESTINATION corehost) -install_symbols (ijwhost corehost) +install_with_stripped_symbols(ijwhost corehost) diff --git a/src/installer/corehost/cli/nethost/CMakeLists.txt b/src/installer/corehost/cli/nethost/CMakeLists.txt index af3edaacd2b1b7..2f09efe72f7703 100644 --- a/src/installer/corehost/cli/nethost/CMakeLists.txt +++ b/src/installer/corehost/cli/nethost/CMakeLists.txt @@ -27,6 +27,5 @@ add_definitions(-DFEATURE_LIBHOST=1) add_definitions(-DNETHOST_EXPORT) install(FILES nethost.h DESTINATION corehost) -install(TARGETS nethost DESTINATION corehost) install(TARGETS libnethost DESTINATION corehost) -install_symbols(nethost corehost) +install_with_stripped_symbols(nethost corehost) diff --git a/src/installer/corehost/cli/test/mockcoreclr/CMakeLists.txt b/src/installer/corehost/cli/test/mockcoreclr/CMakeLists.txt index 9f279c0cd58ac8..539418ea2060d8 100644 --- a/src/installer/corehost/cli/test/mockcoreclr/CMakeLists.txt +++ b/src/installer/corehost/cli/test/mockcoreclr/CMakeLists.txt @@ -17,5 +17,4 @@ endif() include(../testlib.cmake) -install(TARGETS mockcoreclr DESTINATION corehost_test) -install_symbols(mockcoreclr corehost_test) +install_with_stripped_symbols(mockcoreclr corehost_test) diff --git a/src/installer/corehost/cli/test/mockhostfxr/CMakeLists.txt b/src/installer/corehost/cli/test/mockhostfxr/CMakeLists.txt index 7ab97fa4be2a2b..4971de255f8c37 100644 --- a/src/installer/corehost/cli/test/mockhostfxr/CMakeLists.txt +++ b/src/installer/corehost/cli/test/mockhostfxr/CMakeLists.txt @@ -13,5 +13,4 @@ set(SOURCES include(../testlib.cmake) -install(TARGETS mockhostfxr_2_2 DESTINATION corehost_test) -install_symbols(mockhostfxr_2_2 corehost_test) +install_with_stripped_symbols(mockhostfxr_2_2 corehost_test) diff --git a/src/installer/corehost/cli/test/mockhostpolicy/CMakeLists.txt b/src/installer/corehost/cli/test/mockhostpolicy/CMakeLists.txt index 282f477cc596fe..98ccde6e5e8fbd 100644 --- a/src/installer/corehost/cli/test/mockhostpolicy/CMakeLists.txt +++ b/src/installer/corehost/cli/test/mockhostpolicy/CMakeLists.txt @@ -12,5 +12,4 @@ set(SOURCES include(../testlib.cmake) -install(TARGETS mockhostpolicy DESTINATION corehost_test) -install_symbols(mockhostpolicy corehost_test) \ No newline at end of file +install_with_stripped_symbols(mockhostpolicy corehost_test) \ No newline at end of file diff --git a/src/installer/corehost/cli/test/testexe.cmake b/src/installer/corehost/cli/test/testexe.cmake index 0aa25d972f28af..2b61f372fb7d66 100644 --- a/src/installer/corehost/cli/test/testexe.cmake +++ b/src/installer/corehost/cli/test/testexe.cmake @@ -10,7 +10,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/../common.cmake) add_executable(${DOTNET_PROJECT_NAME} ${SOURCES}) -install(TARGETS ${DOTNET_PROJECT_NAME} DESTINATION corehost_test) -install_symbols(${DOTNET_PROJECT_NAME} corehost_test) +install_with_stripped_symbols(${DOTNET_PROJECT_NAME} corehost_test) set_common_libs("exe") \ No newline at end of file diff --git a/src/installer/corehost/cli/winrthost/CMakeLists.txt b/src/installer/corehost/cli/winrthost/CMakeLists.txt index 6b2816405254a0..3853113c8f1c0d 100644 --- a/src/installer/corehost/cli/winrthost/CMakeLists.txt +++ b/src/installer/corehost/cli/winrthost/CMakeLists.txt @@ -32,5 +32,4 @@ endif() target_link_libraries(winrthost RuntimeObject.lib libhostmisc libhostcommon) -install(TARGETS winrthost DESTINATION corehost) -install_symbols(winrthost corehost) +install_with_stripped_symbols(winrthost corehost) diff --git a/src/libraries/Native/Unix/CMakeLists.txt b/src/libraries/Native/Unix/CMakeLists.txt index 4cf22361ee4b57..f21d0dee64e322 100644 --- a/src/libraries/Native/Unix/CMakeLists.txt +++ b/src/libraries/Native/Unix/CMakeLists.txt @@ -176,9 +176,7 @@ if(CLR_CMAKE_TARGET_UNIX) endif(CLR_CMAKE_TARGET_UNIX) function(install_library_and_symbols targetName) - install_symbols(${targetName} .) - set(install_source_file $) - install(PROGRAMS ${install_source_file} DESTINATION .) + install_with_stripped_symbols(${targetName} .) endfunction() include(configure.cmake) From 10684347cfb4a5b8c09ca1844c07bfcd285a5bca Mon Sep 17 00:00:00 2001 From: Jan Vorlicek Date: Fri, 27 Mar 2020 19:01:55 +0100 Subject: [PATCH 3/3] Fix installer placement of lib files --- eng/native/functions.cmake | 12 +++++++++--- src/installer/corehost/cli/comhost/CMakeLists.txt | 2 +- src/installer/corehost/cli/exe.cmake | 2 +- src/installer/corehost/cli/fxr/CMakeLists.txt | 2 +- src/installer/corehost/cli/hostpolicy/CMakeLists.txt | 2 +- src/installer/corehost/cli/ijwhost/CMakeLists.txt | 2 +- src/installer/corehost/cli/nethost/CMakeLists.txt | 2 +- .../corehost/cli/test/mockcoreclr/CMakeLists.txt | 2 +- .../corehost/cli/test/mockhostfxr/CMakeLists.txt | 2 +- .../corehost/cli/test/mockhostpolicy/CMakeLists.txt | 2 +- src/installer/corehost/cli/test/testexe.cmake | 2 +- src/installer/corehost/cli/winrthost/CMakeLists.txt | 2 +- src/libraries/Native/Unix/CMakeLists.txt | 4 ---- .../Unix/System.Globalization.Native/CMakeLists.txt | 2 +- .../Unix/System.IO.Compression.Native/CMakeLists.txt | 2 +- .../Unix/System.IO.Ports.Native/CMakeLists.txt | 2 +- .../Native/Unix/System.Native/CMakeLists.txt | 2 +- .../Unix/System.Net.Security.Native/CMakeLists.txt | 2 +- .../CMakeLists.txt | 2 +- .../CMakeLists.txt | 2 +- 20 files changed, 27 insertions(+), 25 deletions(-) diff --git a/eng/native/functions.cmake b/eng/native/functions.cmake index ae79d15e45c33c..7824fb6a757ae5 100644 --- a/eng/native/functions.cmake +++ b/eng/native/functions.cmake @@ -296,11 +296,17 @@ function(strip_symbols targetName outputFilename) endif(CLR_CMAKE_HOST_UNIX) endfunction() -function(install_with_stripped_symbols targetName destination) +function(install_with_stripped_symbols targetName kind destination) strip_symbols(${targetName} symbol_file) install_symbols(${symbol_file} ${destination}) - set(install_source_file $) - install(PROGRAMS ${install_source_file} DESTINATION ${destination}) + if ("${kind}" STREQUAL "TARGETS") + set(install_source ${targetName}) + elseif("${kind}" STREQUAL "PROGRAMS") + set(install_source $) + else() + message(FATAL_ERROR "The `kind` argument has to be either TARGETS or PROGRAMS, ${kind} was provided instead") + endif() + install(${kind} ${install_source} DESTINATION ${destination}) endfunction() function(install_symbols symbol_file destination_path) diff --git a/src/installer/corehost/cli/comhost/CMakeLists.txt b/src/installer/corehost/cli/comhost/CMakeLists.txt index 4fe7d1a0692a1b..b0f4759ffc682c 100644 --- a/src/installer/corehost/cli/comhost/CMakeLists.txt +++ b/src/installer/corehost/cli/comhost/CMakeLists.txt @@ -42,5 +42,5 @@ if (CLR_CMAKE_TARGET_WIN32) target_link_libraries(comhost ${WINLIBS}) endif() -install_with_stripped_symbols(comhost corehost) +install_with_stripped_symbols(comhost TARGETS corehost) target_link_libraries(comhost libhostcommon) diff --git a/src/installer/corehost/cli/exe.cmake b/src/installer/corehost/cli/exe.cmake index 67852d15d00b82..de8cd49396bd80 100644 --- a/src/installer/corehost/cli/exe.cmake +++ b/src/installer/corehost/cli/exe.cmake @@ -25,6 +25,6 @@ if(NOT CLR_CMAKE_TARGET_WIN32) disable_pax_mprotect(${DOTNET_PROJECT_NAME}) endif() -install_with_stripped_symbols(${DOTNET_PROJECT_NAME} corehost) +install_with_stripped_symbols(${DOTNET_PROJECT_NAME} TARGETS corehost) set_common_libs("exe") diff --git a/src/installer/corehost/cli/fxr/CMakeLists.txt b/src/installer/corehost/cli/fxr/CMakeLists.txt index e22eecae6ee050..216ecbf076bb7b 100644 --- a/src/installer/corehost/cli/fxr/CMakeLists.txt +++ b/src/installer/corehost/cli/fxr/CMakeLists.txt @@ -43,5 +43,5 @@ set(HEADERS include(../lib.cmake) -install_with_stripped_symbols(hostfxr corehost) +install_with_stripped_symbols(hostfxr TARGETS corehost) target_link_libraries(hostfxr libhostcommon) diff --git a/src/installer/corehost/cli/hostpolicy/CMakeLists.txt b/src/installer/corehost/cli/hostpolicy/CMakeLists.txt index d67a109a1c705e..c05c876e1d92ab 100644 --- a/src/installer/corehost/cli/hostpolicy/CMakeLists.txt +++ b/src/installer/corehost/cli/hostpolicy/CMakeLists.txt @@ -34,5 +34,5 @@ set(HEADERS include(../lib.cmake) -install_with_stripped_symbols(hostpolicy corehost) +install_with_stripped_symbols(hostpolicy TARGETS corehost) target_link_libraries(hostpolicy libhostcommon) diff --git a/src/installer/corehost/cli/ijwhost/CMakeLists.txt b/src/installer/corehost/cli/ijwhost/CMakeLists.txt index d13e94928b2e31..46387c0f29299d 100644 --- a/src/installer/corehost/cli/ijwhost/CMakeLists.txt +++ b/src/installer/corehost/cli/ijwhost/CMakeLists.txt @@ -51,4 +51,4 @@ if (CLR_CMAKE_TARGET_WIN32 AND (CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_AR target_link_libraries(ijwhost Advapi32.lib Ole32.lib) endif() -install_with_stripped_symbols(ijwhost corehost) +install_with_stripped_symbols(ijwhost TARGETS corehost) diff --git a/src/installer/corehost/cli/nethost/CMakeLists.txt b/src/installer/corehost/cli/nethost/CMakeLists.txt index 2f09efe72f7703..864129970512cf 100644 --- a/src/installer/corehost/cli/nethost/CMakeLists.txt +++ b/src/installer/corehost/cli/nethost/CMakeLists.txt @@ -28,4 +28,4 @@ add_definitions(-DNETHOST_EXPORT) install(FILES nethost.h DESTINATION corehost) install(TARGETS libnethost DESTINATION corehost) -install_with_stripped_symbols(nethost corehost) +install_with_stripped_symbols(nethost TARGETS corehost) diff --git a/src/installer/corehost/cli/test/mockcoreclr/CMakeLists.txt b/src/installer/corehost/cli/test/mockcoreclr/CMakeLists.txt index 539418ea2060d8..39f96419f0e330 100644 --- a/src/installer/corehost/cli/test/mockcoreclr/CMakeLists.txt +++ b/src/installer/corehost/cli/test/mockcoreclr/CMakeLists.txt @@ -17,4 +17,4 @@ endif() include(../testlib.cmake) -install_with_stripped_symbols(mockcoreclr corehost_test) +install_with_stripped_symbols(mockcoreclr TARGETS corehost_test) diff --git a/src/installer/corehost/cli/test/mockhostfxr/CMakeLists.txt b/src/installer/corehost/cli/test/mockhostfxr/CMakeLists.txt index 4971de255f8c37..bcf6a051229559 100644 --- a/src/installer/corehost/cli/test/mockhostfxr/CMakeLists.txt +++ b/src/installer/corehost/cli/test/mockhostfxr/CMakeLists.txt @@ -13,4 +13,4 @@ set(SOURCES include(../testlib.cmake) -install_with_stripped_symbols(mockhostfxr_2_2 corehost_test) +install_with_stripped_symbols(mockhostfxr_2_2 TARGETS corehost_test) diff --git a/src/installer/corehost/cli/test/mockhostpolicy/CMakeLists.txt b/src/installer/corehost/cli/test/mockhostpolicy/CMakeLists.txt index 98ccde6e5e8fbd..455e86eb436c4d 100644 --- a/src/installer/corehost/cli/test/mockhostpolicy/CMakeLists.txt +++ b/src/installer/corehost/cli/test/mockhostpolicy/CMakeLists.txt @@ -12,4 +12,4 @@ set(SOURCES include(../testlib.cmake) -install_with_stripped_symbols(mockhostpolicy corehost_test) \ No newline at end of file +install_with_stripped_symbols(mockhostpolicy TARGETS corehost_test) \ No newline at end of file diff --git a/src/installer/corehost/cli/test/testexe.cmake b/src/installer/corehost/cli/test/testexe.cmake index 2b61f372fb7d66..6e8ea0aec4307e 100644 --- a/src/installer/corehost/cli/test/testexe.cmake +++ b/src/installer/corehost/cli/test/testexe.cmake @@ -10,6 +10,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/../common.cmake) add_executable(${DOTNET_PROJECT_NAME} ${SOURCES}) -install_with_stripped_symbols(${DOTNET_PROJECT_NAME} corehost_test) +install_with_stripped_symbols(${DOTNET_PROJECT_NAME} TARGETS corehost_test) set_common_libs("exe") \ No newline at end of file diff --git a/src/installer/corehost/cli/winrthost/CMakeLists.txt b/src/installer/corehost/cli/winrthost/CMakeLists.txt index 3853113c8f1c0d..9b3e2b44521c54 100644 --- a/src/installer/corehost/cli/winrthost/CMakeLists.txt +++ b/src/installer/corehost/cli/winrthost/CMakeLists.txt @@ -32,4 +32,4 @@ endif() target_link_libraries(winrthost RuntimeObject.lib libhostmisc libhostcommon) -install_with_stripped_symbols(winrthost corehost) +install_with_stripped_symbols(winrthost TARGETS corehost) diff --git a/src/libraries/Native/Unix/CMakeLists.txt b/src/libraries/Native/Unix/CMakeLists.txt index f21d0dee64e322..bb4dbcbe05f2af 100644 --- a/src/libraries/Native/Unix/CMakeLists.txt +++ b/src/libraries/Native/Unix/CMakeLists.txt @@ -175,10 +175,6 @@ if(CLR_CMAKE_TARGET_UNIX) add_definitions(-DTARGET_UNIX) endif(CLR_CMAKE_TARGET_UNIX) -function(install_library_and_symbols targetName) - install_with_stripped_symbols(${targetName} .) -endfunction() - include(configure.cmake) add_subdirectory(System.IO.Compression.Native) diff --git a/src/libraries/Native/Unix/System.Globalization.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.Globalization.Native/CMakeLists.txt index 4b1afefef0c910..3c4762c90f0ebd 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.Globalization.Native/CMakeLists.txt @@ -76,7 +76,7 @@ if (GEN_SHARED_LIB) dl ) - install_library_and_symbols (System.Globalization.Native) + install_with_stripped_symbols (System.Globalization.Native PROGRAMS .) endif() add_library(System.Globalization.Native-Static diff --git a/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt index aea162451fa939..1cd9ca778923a2 100644 --- a/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt @@ -56,7 +56,7 @@ if (GEN_SHARED_LIB) target_link_libraries(System.IO.Compression.Native ${ZLIB_LIBRARIES} ) - install_library_and_symbols (System.IO.Compression.Native) + install_with_stripped_symbols (System.IO.Compression.Native PROGRAMS .) endif () add_library(System.IO.Compression.Native-Static diff --git a/src/libraries/Native/Unix/System.IO.Ports.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.IO.Ports.Native/CMakeLists.txt index f076b642f21cc7..1750a07d73c82b 100644 --- a/src/libraries/Native/Unix/System.IO.Ports.Native/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.IO.Ports.Native/CMakeLists.txt @@ -15,5 +15,5 @@ add_library(System.IO.Ports.Native-Static set_target_properties(System.IO.Ports.Native-Static PROPERTIES OUTPUT_NAME System.IO.Ports.Native CLEAN_DIRECT_OUTPUT 1) -install_library_and_symbols (System.IO.Ports.Native) +install_with_stripped_symbols (System.IO.Ports.Native PROGRAMS .) install (TARGETS System.IO.Ports.Native-Static DESTINATION .) diff --git a/src/libraries/Native/Unix/System.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.Native/CMakeLists.txt index 7bf8031bcb6166..f4bd26b5f3c3b6 100644 --- a/src/libraries/Native/Unix/System.Native/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.Native/CMakeLists.txt @@ -59,7 +59,7 @@ if (GEN_SHARED_LIB) target_link_libraries(System.Native ${INOTIFY_LIBRARY}) endif () endif () - install_library_and_symbols (System.Native) + install_with_stripped_symbols (System.Native PROGRAMS .) endif () add_library(System.Native-Static diff --git a/src/libraries/Native/Unix/System.Net.Security.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.Net.Security.Native/CMakeLists.txt index 12e0c9683d3862..6514f0eac52e76 100644 --- a/src/libraries/Native/Unix/System.Net.Security.Native/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.Net.Security.Native/CMakeLists.txt @@ -42,5 +42,5 @@ target_link_libraries(System.Net.Security.Native ${LIBGSS} ) -install_library_and_symbols (System.Net.Security.Native) +install_with_stripped_symbols (System.Net.Security.Native PROGRAMS .) install (TARGETS System.Net.Security.Native-Static DESTINATION .) diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/CMakeLists.txt b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/CMakeLists.txt index d8f6eb28445f7b..1cdfbfe99be837 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/CMakeLists.txt @@ -43,5 +43,5 @@ target_link_libraries(System.Security.Cryptography.Native.Apple ${SECURITY_LIBRARY} ) -install_library_and_symbols (System.Security.Cryptography.Native.Apple) +install_with_stripped_symbols (System.Security.Cryptography.Native.Apple PROGRAMS .) install (TARGETS System.Security.Cryptography.Native.Apple-Static DESTINATION .) diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.Security.Cryptography.Native/CMakeLists.txt index fd7563c73cd851..7be3d61aa3bc72 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/CMakeLists.txt @@ -106,5 +106,5 @@ endif() include(configure.cmake) -install_library_and_symbols (System.Security.Cryptography.Native.OpenSsl) +install_with_stripped_symbols (System.Security.Cryptography.Native.OpenSsl PROGRAMS .) install (TARGETS System.Security.Cryptography.Native.OpenSsl-Static DESTINATION .)