there dynamic-linking-conflict between different libjpeg dynamic libraries on osx. first there standard native libjpeg.dylib (in /system/library/frameworks/imageio.framework/versions/a/resources/). if using macports, can have port-related libjpeg.dylib in (in /opt/local/lib). latter may example have been installed dependency other port.
this creates problem when link against system libjpeg (which preferred). if /opt/local/lib
in dyld_library_path, path prioritised when searching dynamic lib, resulting in runtime error when loading symbols:
dyld: symbol not found: __cg_jpeg_resync_to_restart referenced from: /system/library/frameworks/imageio.framework/versions/a/imageio expected in: /opt/local/lib/libjpeg.dylib in /system/library/frameworks/imageio.framework/versions/a/imageio trace/bpt trap: 5
so have 2 questions (likely related):
what way of solving actual problem (removing
/opt/local/lib
dyld_library_path
solves creates problems other dependencies)?what other paths searched dynamic libs (i.e. "/system/library" path specified) , why dyld_library_path rank higher priority-wise?
you should not set library paths using dyld_library_path
. you've discovered, tends explode. executables , libraries should have library requirements built them @ link time. use otool -l
find out file looking for:
$ otool -l /system/library/frameworks/imageio.framework/versions/a/imageio /system/library/frameworks/imageio.framework/versions/a/imageio: /system/library/frameworks/imageio.framework/versions/a/imageio (compatibility version 1.0.0, current version 1.0.0) ... /usr/lib/libsystem.b.dylib (compatibility version 1.0.0, current version 1197.1.1)
for example of 1 of homebrew-built programs:
$ otool -l /usr/local/bin/gifcolor /usr/local/bin/gifcolor: /usr/local/cellar/giflib/4.1.6/lib/libgif.4.dylib (compatibility version 6.0.0, current version 6.6.0) /usr/lib/libsystem.b.dylib (compatibility version 1.0.0, current version 159.1.0)
note references /usr/local
. if you've built in such way references wrong library, recommend rebuilding , pointing correctly library.
if that's impossible, possible edit path used using install_name_tool
, there cases doesn't work, such if new path longer old path , didn't link -header_pad_max_install_names
. rebuilding correct path preferred.
note there few "special" paths available allow libraries found relative loader. see @executable_path/
, kin in dyld(1)
man page.
Comments
Post a Comment