Solving some "Symbol not found" problems for libJPEG, libTIFF, libGL, libPng

Ryan Schmidt ryandesign at macports.org
Thu Nov 18 12:19:13 PST 2010


The Apple and MacPorts versions of these libraries coexist just fine most cases. I cannot advocate the steps you described below, and without further information, I cannot say why you experienced problems before.


On Nov 18, 2010, at 13:57, Robert Baruch wrote:

> Hi all,
> 
> To save some of you some time, if you run something and you get an error like this:
> 
> dyld: Symbol not found: _gll_noop 
>  Referenced from: 
> /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL 
>  Expected in: /opt/local/lib/libGL.dylib
> 
> or this:
> 
> dyld: Symbol not found: __cg_jpeg_resync_to_restart 
>  Referenced from: 
> /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO 
>  Expected in: /opt/local/lib/libJPEG.dylib 
> 
> or this:
> 
> dyld: lazy symbol binding failed: Symbol not found: __cg_TIFFSetErrorHandler
> Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO
> Expected in: /opt/local/lib/libTIFF.dylib
> 
> or this:
> dyld: Symbol not found: __cg_png_create_info_struct
>  Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO
>  Expected in: /optlocal/lib/libPng.dylib
> Then congratulations, you've discovered that OSX and MacPorts are incompatible with each other for these libraries! For example, Macport's libjpeg contains the symbol _jpeg_resync_to_restart, but not what Apple is looking for, __cg_jpeg_resync_to_restart.
> 
> I have seen several solutions, including "removing any DYLD_LIBRARY_PATH" (which doesn't help when you don't have it set), and "removing the offending macports library", which doesn't help when it will just get reinstalled when you try to install a port which has those libraries as a dependency.
> 
> The solution that worked for me was this (note that if you don't have a particular /opt/local/lib library then you don't need that line)
> 
> sudo ln -sf /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib /opt/local/lib/libGL.dylib
> 
> sudo ln -sf /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libPng.dylib /opt/local/lib/libpng.dylib
> 
> sudo ln -sf /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib /opt/local/lib/libtiff.dylib
> 
> sudo ln -sf /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libJPEG.dylib /opt/local/lib/libjpeg.dylib
> 
> Why does this work? Because for whatever reason, when Apple requests libJPEG.dyld, whatever system searches for it finds /opt/local/lib/libjpeg.dyld because the search is case insensitive. For a Unix operating system. Go figure. The lines above will force any program looking for libjpeg.dyld to be redirected to Apple's libJPEG.dyld.
> 
> But wait, what if you WANT Macport's libjpeg.dyld? Sorry, not possible unless you statically link your program to libjpeg.a. And since I've never done that before, I can't help you if you want to do that :(
> 
> --Rob




More information about the macports-users mailing list