[PATCH] D25382: Add @loader_path to rpath on mac

Derek Schuff via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 7 15:11:17 PDT 2016


dschuff created this revision.
dschuff added a subscriber: llvm-commits.
Herald added subscribers: mgorny, beanz.

Currently @executable_path/../lib is used as the rpath for mac builds.
When using LLVM_LINK_LLVM_DYLIB, libLTO.dylib is linked against libLLVM.dylib,
just like all the executables. However libLTO fails to load because in this
case the executable is ld (instead of one of the LLVM tools) which is in a
different location. Adding @loader_path to the rpath list fixes this
problem.


https://reviews.llvm.org/D25382

Files:
  CMakeLists.txt


Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -675,7 +675,7 @@
 set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
 if (APPLE)
   set(CMAKE_INSTALL_NAME_DIR "@rpath")
-  set(CMAKE_INSTALL_RPATH "@executable_path/../lib")
+  set(CMAKE_INSTALL_RPATH "@executable_path/../lib;@loader_path/../lib")
 else(UNIX)
   if(NOT DEFINED CMAKE_INSTALL_RPATH)
     set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25382.73994.patch
Type: text/x-patch
Size: 488 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161007/b562b721/attachment.bin>


More information about the llvm-commits mailing list