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

David Fang fang at csl.cornell.edu
Wed Feb 26 13:46:01 PST 2014


>> While it may be 'correct' on more recent darwin, darwin8 doesn't understand
>> @rpath.
>
> :-(
>
>> So using CMAKE_INSTALL_NAME_DIR = @executable_path/../lib seems to work
>> well, and lets me run binaries from the build directory.
>> Then installation follows the same directory structure as the build dir, so
>> it works fine.  Is there anything bad about linking this way?
>
> You mean like the attached patch? It does seem to work on current OS
> X, so if it also works on old ones we could switch.
>
> Can you confirm that it fixes the build for you?

This patch is exactly what I've tried.

e.g. of resulting binaries:
% otool -L bin/llvm-tblgen
bin/llvm-tblgen:
         @executable_path/../lib/libLLVMSupport.dylib (compatibility 
version 0.0.0, current version 0.0.0)
         @executable_path/../lib/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)

% otool -L lib/libLLVMTableGen.dylib
lib/libLLVMTableGen.dylib:
         @executable_path/../lib/libLLVMTableGen.dylib (compatibility 
version 0.0.0, current version 0.0.0)
         @executable_path/../lib/libLLVMSupport.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 executables in the built area seems to run fine, but I haven't gotten 
a chance to install it (due to unrelated issues).  I can get back to you 
about installation after I resolve those.

David


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




More information about the llvm-commits mailing list