问题
I have installed freetype-2.5.3 on OS X (10.9.4) in my local directory in which I park all science software (/Users/t/Science/local), and now my other codes are running into trouble, i.e.
:/Users/t> make dyld: Symbol not found: __cg_png_create_info_struct Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO Expected in: /Users/t/Science/local/lib/libPng.dylib in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO make: error: unable to locate xcodebuild, please make sure the path to the Xcode folder is set correctly! make: error: You can set the path to the Xcode folder using /usr/bin/xcode-select -switch :/Users/t> /usr/bin/xcode-select -p /Applications/Xcode.app/Contents/Developer
The Xcode path seems to be okay. How do I get libPng.dylib from my system to be the default again?
Many thanks!
回答1:
I had this problem because I installed libpng with brew. Running the following command solved the problem :
brew uninstall libpng
And if you need both the default mac libpng and this one...good luck. I had to install/uninstall libpng with brew oftently.
回答2:
I suspect the issue is that you have set the DYLD_LIBRARY_PATH environment variable and have it pointed to /Users/t/Science/local/lib ... that will cause the system to pick up YOUR libpng when it is trying to resolve the path to its libpng.
Don't do that. If you find that setting DYLD_LIBRARY_PATH "fixes" some problem, it is almost certainly not the actual fix to the problem. It is more likely that you have incorrect dylib ids in your libraries such that the resulting linkage is incorrect.
回答3:
It appears that you have replaced the libpng that was built with a "__cg_" prefix on its exported names. You could try reinstalling libpng from source, using the
"--with-libpng-prefix=__cg_"
configure option, which may be how libpng was installed previously. That option became available in libpng16 (libpng-1.6.0 but not really completely working until libpng-1.6.3).
回答4:
Removing the line LIBS += -L/opt/local/lib
from the .pro file helped.
来源:https://stackoverflow.com/questions/26066445/trouble-with-the-libpng-dylib-from-freetype-2-5-3