From 90c1be00a29214642b1f24cd485fe42e2ec2b2ed Mon Sep 17 00:00:00 2001 From: Davide Italiano Date: Tue, 7 Aug 2018 12:28:35 -0600 Subject: [PATCH] [REPL] Set the correct rpath when installing. $ORIGIN represents the location of the REPL at runtime, whenever the binary is located. So, this makes sure that when we generate the toolchain on one machine and transfer to another, the repl keeps working, as it needs to `dlopen` libSwiftCore, which sits in a path relative to the executable itself. --- tools/repl/swift/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/repl/swift/CMakeLists.txt b/tools/repl/swift/CMakeLists.txt index 2515d86adab3..237e6ec06444 100644 --- a/tools/repl/swift/CMakeLists.txt +++ b/tools/repl/swift/CMakeLists.txt @@ -5,6 +5,7 @@ if (LLDB_BUILD_FRAMEWORK) elseif( CMAKE_SYSTEM_NAME MATCHES "Linux" ) # Set the correct rpath to locate libswiftCore set(CMAKE_EXE_LINKER_FLAGS "-Wl,-rpath,${CMAKE_BINARY_DIR}/../swift-linux-x86_64/lib${LLVM_LIBDIR_SUFFIX}/swift/linux -Wl,-ldl") + set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib/swift/linux:${CMAKE_INSTALL_RPATH}") endif() add_lldb_tool(repl_swift