[llvm] r201921 - Use relative rpath so that the installation and build dirs are relocatable.

David Fang fang at csl.cornell.edu
Tue Feb 25 17:35:39 PST 2014


Hi,
 	This patch is giving me runtime dyld errors on darwin8 
(cmake+shared build):

[  6%] Building Intrinsics.gen...
dyld: Library not loaded: @rpath/libLLVMSupport.dylib
   Referenced from: 
/Volumes/Isolde/builds/LLVM/gcc40-cmake-build/include/llvm/IR/../../../bin/llvm-tblgen
   Reason: image not found
make[2]: *** [include/llvm/IR/Intrinsics.gen.tmp] Error 133
make[1]: *** [include/llvm/IR/CMakeFiles/intrinsics_gen.dir/all] Error 2
make: *** [all] Error 2

because:

% otool -L bin/llvm-tblgen
bin/llvm-tblgen:
         @rpath/libLLVMSupport.dylib (compatibility version 0.0.0, current 
version 0.0.0)
         @rpath/libLLVMTableGen.dylib (compatibility version 0.0.0, current 
version 0.0.0)
         /usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, 
current version 5.4.0)
         /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current 
version 88.1.12)
         /usr/lib/libz.1.dylib (compatibility version 1.0.0, current 
version 1.2.3)
         /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current 
version 7.4.0)
         /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current 
version 1.0.0)


The old 'set( CMAKE_INSTALL_RPATH "\$ORIGIN/../lib")' used to work fine.

I suppose I could attempt to conditionally use the old behavior depending 
on host OS X version?  Or can I also use @executable_path/../lib as 
CMAKE_INSTALL_NAME_DIR?

David



> Author: rafael
> Date: Fri Feb 21 18:54:14 2014
> New Revision: 201921
>
> URL: http://llvm.org/viewvc/llvm-project?rev=201921&view=rev
> Log:
> Use relative rpath so that the installation and build dirs are relocatable.
>
> This works by asking cmake to use the "install rpath", but setting that rpath
> to be relative.
>
> Thanks a lot to Brad King for the help with CMake!
>
> Modified:
>    llvm/trunk/CMakeLists.txt
>
> Modified: llvm/trunk/CMakeLists.txt
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=201921&r1=201920&r2=201921&view=diff
> ==============================================================================
> --- llvm/trunk/CMakeLists.txt (original)
> +++ llvm/trunk/CMakeLists.txt Fri Feb 21 18:54:14 2014
> @@ -423,9 +423,13 @@ set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LL
> set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib )
> set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib )
>
> -if( NOT DEFINED CMAKE_INSTALL_RPATH )
> -  set( CMAKE_INSTALL_RPATH "\$ORIGIN/../lib")
> -endif( NOT DEFINED CMAKE_INSTALL_RPATH )
> +set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
> +if (APPLE)
> +  set(CMAKE_INSTALL_NAME_DIR "@rpath")
> +  set(CMAKE_INSTALL_RPATH "@executable_path/../lib")
> +else(UNIX)
> +  set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib")
> +endif()
>
> set(CMAKE_INCLUDE_CURRENT_DIR ON)
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>

-- 
David Fang
http://www.csl.cornell.edu/~fang/




More information about the llvm-commits mailing list