From eac34237f8ee3e85a42af772fa37671c1dbfee73 Mon Sep 17 00:00:00 2001 From: Omair Majid Date: Wed, 23 Sep 2020 10:48:12 -0400 Subject: [PATCH] Fix singlefilehost build in non-portable mode (#42415) The singilefilehost needs to follow the libraries build in terms of how it links to OpenSSL: if it's a non-portable build, the singlefilehost needs to link to OpenSSL via linker arguments. The installer also needs to have FEATURE_DISTRO_AGNOSTIC_SSL defined just like it is defined for the libraries build. Fixes: #41768 --- src/installer/corehost/build.sh | 1 + src/installer/corehost/cli/apphost/static/CMakeLists.txt | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/installer/corehost/build.sh b/src/installer/corehost/build.sh index c0bbce8..bd789c6 100755 --- a/src/installer/corehost/build.sh +++ b/src/installer/corehost/build.sh @@ -92,6 +92,7 @@ export __BinDir __IntermediatesDir __CoreClrArtifacts __NativeLibsArtifacts __CMakeArgs="-DCLI_CMAKE_HOST_VER=\"$__host_ver\" -DCLI_CMAKE_COMMON_HOST_VER=\"$__apphost_ver\" -DCLI_CMAKE_HOST_FXR_VER=\"$__fxr_ver\" $__CMakeArgs" __CMakeArgs="-DCLI_CMAKE_HOST_POLICY_VER=\"$__policy_ver\" -DCLI_CMAKE_PKG_RID=\"$__DistroRid\" -DCLI_CMAKE_COMMIT_HASH=\"$__commit_hash\" $__CMakeArgs" __CMakeArgs="-DCORECLR_ARTIFACTS=\"$__CoreClrArtifacts\" -DNATIVE_LIBS_ARTIFACTS=\"$__NativeLibsArtifacts\" $__CMakeArgs" +__CMakeArgs="-DFEATURE_DISTRO_AGNOSTIC_SSL=$__PortableBuild $__CMakeArgs" if [[ "$__PortableBuild" == 1 ]]; then __CMakeArgs="-DCLI_CMAKE_PORTABLE_BUILD=1 $__CMakeArgs" diff --git a/src/installer/corehost/cli/apphost/static/CMakeLists.txt b/src/installer/corehost/cli/apphost/static/CMakeLists.txt index e6369f6..fd2508e 100644 --- a/src/installer/corehost/cli/apphost/static/CMakeLists.txt +++ b/src/installer/corehost/cli/apphost/static/CMakeLists.txt @@ -191,6 +191,11 @@ else() # ) endif () + # Additional requirements for System.Security.Cryptography.Native.OpenSsl + if(NOT FEATURE_DISTRO_AGNOSTIC_SSL) + find_package(OpenSSL) + endif() + if(CLR_CMAKE_TARGET_LINUX OR CLR_CMAKE_TARGET_FREEBSD OR CLR_CMAKE_TARGET_NETBSD OR CLR_CMAKE_TARGET_SUNOS) # These options are used to force every object to be included even if it's unused. set(START_WHOLE_ARCHIVE -Wl,--whole-archive) @@ -213,3 +218,10 @@ target_link_libraries(singlefilehost ${NATIVE_LIBS_EXTRA} ) + +if(NOT FEATURE_DISTRO_AGNOSTIC_SSL) + target_link_libraries(singlefilehost + ${OPENSSL_CRYPTO_LIBRARY} + ${OPENSSL_SSL_LIBRARY} + ) +endif() -- 2.7.4