From 96c64a82978ac2cc9490119dbf590dfe0495491c Mon Sep 17 00:00:00 2001 From: Jan Vorlicek Date: Tue, 11 Apr 2017 15:06:22 -0700 Subject: [PATCH] Add support for local copies of native dependencies on Linux This change adds support for local copies of native dependencies for standalone apps on Linux. If there is a folder called netcoredeps next to the main app executable, the system dynamic loader looks into that folder first when resolving shared library dependencies of the main app and all of the shared libraries it transitively loads. Commit migrated from https://github.com/dotnet/core-setup/commit/ee1d44b9edccf5f472ce2407b9cde7b8b5715bb0 --- src/installer/corehost/cli/exe/apphost/CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/installer/corehost/cli/exe/apphost/CMakeLists.txt b/src/installer/corehost/cli/exe/apphost/CMakeLists.txt index 8a4fa7acf62..76448440566 100644 --- a/src/installer/corehost/cli/exe/apphost/CMakeLists.txt +++ b/src/installer/corehost/cli/exe/apphost/CMakeLists.txt @@ -3,6 +3,17 @@ cmake_minimum_required (VERSION 2.6) set(DOTNET_HOST_EXE_NAME "apphost") + +# Add RPATH to the apphost binary that allows using local copies of shared libraries +# dotnet core depends on for special scenarios when system wide installation of such +# dependencies is not possible for some reason. +# This cannot be enabled for MacOS (Darwin) since its RPATH works in a different way, +# doesn't apply to libraries loaded via dlopen and most importantly, it is not transitive. +if (NOT CMAKE_SYSTEM_NAME STREQUAL Darwin) + set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) + set(CMAKE_INSTALL_RPATH "\$ORIGIN/netcoredeps") +endif() + include(../exe.cmake) set(SOURCES) add_definitions(-DFEATURE_APPHOST=1) -- GitLab