osx - dylib set by rpath is not loaded in OS X -
i making package manager, , ensure packages use correct dependent library setting rpath
option @ compile time. surprised me in os x (10.11), here problem:
$ otool -l /opt/starman/software/gcc/6.1.0/83894f21d07366be296600ec031ae4f6241381d9/libexec/gcc/x86_64-apple-darwin15.5.0/6.1.0/f951 /opt/starman/software/gcc/6.1.0/83894f21d07366be296600ec031ae4f6241381d9/libexec/gcc/x86_64-apple-darwin15.5.0/6.1.0/f951: /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0) /opt/starman/software/isl/0.17.1/104994def2b7fb2dae7950b42205eb718a46ee0c/lib/libisl.15.dylib (compatibility version 18.0.0, current version 18.1.0) /opt/starman/software/mpc/1.0.3/6058925218009b8ab17e07333dc54de334134f6e/lib/libmpc.3.dylib (compatibility version 4.0.0, current version 4.0.0) /opt/starman/software/mpfr/3.1.4/f142dfcda3b56650a8c9cfe2fdd09ffdf7283a00/lib/libmpfr.4.dylib (compatibility version 6.0.0, current version 6.4.0) /opt/starman/software/gmp/6.1.0/0ec8ef118d09cb33f83559685d006f56a74f865c/lib/libgmp.10.dylib (compatibility version 14.0.0, current version 14.0.0) /usr/lib/libsystem.b.dylib (compatibility version 1.0.0, current version 1226.10.1)
see gmp
version 14.0.0
.
$ /opt/starman/software/gcc/6.1.0/83894f21d07366be296600ec031ae4f6241381d9/libexec/gcc/x86_64-apple-darwin15.5.0/6.1.0/f951 dyld: library not loaded: /opt/starman/software/gmp/6.1.0/0ec8ef118d09cb33f83559685d006f56a74f865c/lib/libgmp.10.dylib referenced from: /opt/starman/software/gcc/6.1.0/83894f21d07366be296600ec031ae4f6241381d9/libexec/gcc/x86_64-apple-darwin15.5.0/6.1.0/f951 reason: incompatible library version: f951 requires version 14.0.0 or later, libgmp.10.dylib provides version 13.0.0 trace/bpt trap: 5
it says gmp
in correct path not loaded since version 13.0.0
, 14.0.0
! know have older version gmp
installed in path, after remove lib path dyld_library_path
, problem gone, shouldn't rpath
solve problem?
why dyld
prints correct path of gmp
, uses wrong old? there tricks in os x? help!
edit 1: version of /opt/starman/software/gmp/6.1.0/0ec8ef118d09cb33f83559685d006f56a74f865c/lib/libgmp.10.dylib
checked as
$ otool -l /opt/starman/software/gmp/6.1.0/0ec8ef118d09cb33f83559685d006f56a74f865c/lib/libgmp.10.dylib ... cmdsize 120 name /opt/starman/software/gmp/6.1.0/0ec8ef118d09cb33f83559685d006f56a74f865c/lib/libgmp.10.dylib (offset 24) time stamp 1 thu jan 1 08:00:01 1970 current version 14.0.0 compatibility version 14.0.0 ...
and older gmp
is
$ otool -l /opt/software/gmp/6.0.0a/0/lib/libgmp.10.dylib ... name @rpath/lib/libgmp.dylib (offset 24) time stamp 1 thu jan 1 08:00:01 1970 current version 13.0.0 compatibility version 13.0.0 ...
eidt 2
according 0xced
, run debug loading process (the full output here):
$ export dyld_print_libraries="1" $ /opt/starman/software/gcc/6.1.0/83894f21d07366be296600ec031ae4f6241381d9/libexec/gcc/x86_64-apple-darwin15.5.0/6.1.0/f951 dyld: loaded: /opt/starman/software/gcc/6.1.0/83894f21d07366be296600ec031ae4f6241381d9/libexec/gcc/x86_64-apple-darwin15.5.0/6.1.0/f951 dyld: loaded: /usr/lib/libiconv.2.dylib dyld: loaded: /opt/starman/software/isl/0.17.1/104994def2b7fb2dae7950b42205eb718a46ee0c/lib/libisl.15.dylib dyld: loaded: /opt/software/packman.active/lib/libmpc.3.dylib dyld: loaded: /opt/software/packman.active/lib/libmpfr.4.dylib dyld: loaded: /opt/software/packman.active/lib/libgmp.10.dylib dyld: unloaded: /opt/starman/software/gcc/6.1.0/83894f21d07366be296600ec031ae4f6241381d9/libexec/gcc/x86_64-apple-darwin15.5.0/6.1.0/f951 dyld: unloaded: /opt/starman/software/isl/0.17.1/104994def2b7fb2dae7950b42205eb718a46ee0c/lib/libisl.15.dylib dyld: unloaded: /opt/software/packman.active/lib/libmpc.3.dylib dyld: unloaded: /opt/software/packman.active/lib/libmpfr.4.dylib dyld: unloaded: /opt/software/packman.active/lib/libgmp.10.dylib dyld: library not loaded: /opt/starman/software/gmp/6.1.0/0ec8ef118d09cb33f83559685d006f56a74f865c/lib/libgmp.10.dylib referenced from: /opt/starman/software/gcc/6.1.0/83894f21d07366be296600ec031ae4f6241381d9/libexec/gcc/x86_64-apple-darwin15.5.0/6.1.0/f951 reason: incompatible library version: f951 requires version 14.0.0 or later, libgmp.10.dylib provides version 13.0.0 trace/bpt trap: 5
i don't understand why f951
binary load /opt/software/gmp/6.0.0a/0/lib/libgmp.10.dylib
(version 13) rather /opt/starman/software/gmp/6.1.0/0ec8ef118d09cb33f83559685d006f56a74f865c/lib/libgmp.10.dylib
(version 14) specified absolute path , not relative @rpath
.
maybe it’s loaded indirectly via library, e.g. libisl.15.dylib, libmpc.3.dylib or libmpfr.4.dylib have @rpath reference libgmp.10.dylib?
to diagnose issue, suggest run main executable this:
$ dyld_print_rpaths=yes /opt/starman/software/gcc/6.1.0/83894f21d07366be296600ec031ae4f6241381d9/libexec/gcc/x86_64-apple-darwin15.5.0/6.1.0/f951
this print rpath expansions (both failure , success) , give answer question.