#51542: clang-3.8 and clang-3.9 fail to function due to rpath -------------------------------------+------------------------ Reporter: kenneth.f.cunningham@… | Owner: jeremyhu@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.4 Resolution: | Keywords: Port: clang-3.8 | -------------------------------------+------------------------ Comment (by kenneth.f.cunningham@…): Thanks for looking. Wish I had your knowledge. I get similar otool output to what you get {{{ $ port select --list clang Available versions for clang: mp-clang-3.4 mp-clang-3.7 mp-clang-3.8 (active) mp-clang-3.9 none $ port select --list llvm Available versions for llvm: mp-llvm-3.4 mp-llvm-3.7 mp-llvm-3.8 (active) mp-llvm-3.9 none $ clang hello.c -o hello dyld: Library not loaded: @rpath/libLLVM.dylib Referenced from: /opt/local/libexec/llvm-3.8/bin/../lib/libLTO.dylib Reason: image not found clang: error: unable to execute command: Trace/BPT trap clang: error: linker command failed due to signal (use -v to see invocation) $ otool -l /opt/local/libexec/llvm-3.8/bin/../lib/libLTO.dylib | grep -A2 LC_RPATH cmd LC_RPATH cmdsize 32 path @loader_path (offset 12) -- cmd LC_RPATH cmdsize 40 path @executable_path/../lib (offset 12) }}} the DYLD_PRINT_RPATHS=1 was not too satisfying - I suspect this might not be available on snowleopard as I couldn't find it in the man page for dyld on this machine {{{ $ export DYLD_PRINT_RPATHS=1 $ clang hello.c -o hellodyld: warning, unknown environment variable: DYLD_PRINT_RPATHS dyld: warning, unknown environment variable: DYLD_PRINT_RPATHS dyld: warning, unknown environment variable: DYLD_PRINT_RPATHS dyld: warning, unknown environment variable: DYLD_PRINT_RPATHS dyld: Library not loaded: @rpath/libLLVM.dylib Referenced from: /opt/local/libexec/llvm-3.8/bin/../lib/libLTO.dylib Reason: image not found clang: error: unable to execute command: Trace/BPT trap clang: error: linker command failed due to signal (use -v to see invocation) }}} Switching back to clang-3.7 everything works fine. Here's the output from otool for clang-3.7. {{{ $ sudo port select clang mp-clang-3.7 Selecting 'mp-clang-3.7' for 'clang' succeeded. 'mp-clang-3.7' is now active. $ sudo port select llvm mp-llvm-3.7 Selecting 'mp-llvm-3.7' for 'llvm' succeeded. 'mp-llvm-3.7' is now active. $ clang hello.c -o hello $ otool -l /opt/local/libexec/llvm-3.7/bin/../lib/libLTO.dylib | grep -A2 LC_RPATH cmd LC_RPATH cmdsize 40 path @executable_path/../lib (offset 12) }}} and finally, of course setting the library fallback path manually works {{{ $ export DYLD_FALLBACK_LIBRARY_PATH=/opt/local/libexec/llvm-3.9/lib/ $ clang -v hello.c -o hello clang version 3.9.0 (trunk 270400) Target: x86_64-apple-darwin10.8.0 Thread model: posix InstalledDir: /opt/local/libexec/llvm-3.9/bin "/opt/local/libexec/llvm-3.9/bin/clang" -cc1 -triple x86_64-apple- macosx10.6.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -main-file-name hello.c -mrelocation- model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm- verbose -munwind-tables -target-cpu core2 -target-linker-version 136 -v -dwarf-column-info -debugger-tuning=lldb -resource-dir /opt/local/libexec/llvm-3.9/bin/../lib/clang/3.9.0 -fdebug-compilation-dir /Users/Shared/test_llvm -ferror-limit 19 -fmessage-length 80 -stack- protector 1 -fblocks -fobjc-runtime=macosx-10.6.0 -fencode-extended-block- signature -fmax-type-align=16 -fdiagnostics-show-option -fcolor- diagnostics -o /var/folders/I0/I0fOotq3ErGZHYxrmmWiqU+++TI/-Tmp-/hello- 49b326.o -x c hello.c clang -cc1 version 3.9.0 based upon LLVM 3.9.0svn default target x86_64 -apple-darwin10.8.0 #include "..." search starts here: #include <...> search starts here: /usr/local/include /opt/local/libexec/llvm-3.9/bin/../lib/clang/3.9.0/include /usr/include /System/Library/Frameworks (framework directory) /Library/Frameworks (framework directory) End of search list. "/opt/local/libexec/llvm-3.9/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.6.0 -o hello -lcrt1.10.6.o /var/folders/I0/I0fOotq3ErGZHYxrmmWiqU+++TI/-Tmp-/hello-49b326.o -lSystem /opt/local/libexec/llvm-3.9/bin/../lib/clang/3.9.0/lib/darwin/libclang_rt.osx.a $ ./hello hello world }}} just odd I didn't have to do that manual lib path setting for clang-3.7 hope this is helpful to someone -- Ticket URL: <https://trac.macports.org/ticket/51542#comment:5> MacPorts <https://www.macports.org/> Ports system for OS X