# DYLD_FALLBACK_LIBRARY_PATH breaks library path resolution when you have two applications that # have a library name collision and use DYLD_* varibles to force dyld to find their libraries -- a # use-case that would work without error when using proper install name/@rpath Mach-O linking. mkdir rust-lib mkdir mathematica-lib echo 'void my_libjpeg_api (void) { }' | clang -dynamiclib -x objective-c -o rust-lib/libjpeg.dylib -install_name libjpeg.dylib - clang -dynamiclib -x objective-c -o mathematica-lib/libjpeg.dylib -install_name libjpeg.dylib - < /dev/null echo 'extern void my_libjpeg_api(void); int main (int argc, char *argv[]) { my_libjpeg_api(); return 0; }' | clang -x objective-c -o example - -framework ImageIO -Lrust-lib -ljpeg env DYLD_FALLBACK_LIBRARY_PATH=`pwd`/mathematica-lib:`pwd`/rust-lib ./example #dyld: lazy symbol binding failed: Symbol not found: _my_libjpeg_api # Referenced from: /private/tmp/./example # Expected in: /tmp/mathematica-lib/libjpeg.dylib # #dyld: Symbol not found: _my_libjpeg_api # Referenced from: /private/tmp/./example # Expected in: /tmp/mathematica-lib/libjpeg.dylib