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

cssdev at mac.com cssdev at mac.com
Thu Nov 18 13:22:20 PST 2010


You could also use DYLD_FALLBACK_LIBRARY_PATH. I had to use that to avoid Apple's libJPEG getting in the way of apps that expected the libjpeg port. See the man page for dlopen() for details.

Chris

-- 
Sent from my iPod 

On Nov 18, 2010, at 2:57 PM, Robert Baruch <robert.c.baruch at gmail.com> 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
> _______________________________________________
> macports-users mailing list
> macports-users at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macports-users


More information about the macports-users mailing list