Recently, I unsuccessfully tried to install a series of badly written software in a hacky way (won't bore you with the details) and now it seems my OS X (Lion, 10.7.5) system files are a mess. I'll try to keep it brief.
1) Not being able to open any software from the Terminal because of dyld error messages
2) Having two versions of libiconv installed, one of them too old and the other incomplete, and struggling to resolve the situation
First example of 1): running some software (installed long ago) which I think requires XCode and such and is Python based results in this:
... ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/glib/_glib.so, 2): Library not loaded: /opt/local/lib/libiconv.2.dylib Referenced from: /opt/local/lib/libgobject-2.0.0.dylib Reason: Incompatible library version: libgobject-2.0.0.dylib requires version 8.0.0 or later, but libiconv.2.dylib provides version 7.0.0
However, otool reveals that /opt/local/lib/libiconv.2.dylib is version 8.1.0. I think this is the version installed by MacPorts.
$ otool -L /usr/lib/libiconv.2.dylib /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
So I think I have an old version (7.0.0) to which the software that I'm trying to run refers by mistake. I'm hesitant to re-install the software because a guru friend who is now on the other side of the world helped me with it (it's not been tested on OS X and I think he created a binary and who knows what else.) But in any case, I get messages like this for pretty much everything I'm trying to run from the command line, so I don't know if it's simply a case of having to re-install all my software.
Apparently I need to get iconv's newest version, this should update libiconv? So I got the newest iconv (1.14) by downloading and configuring - perhaps it will overwrite that old 7.0.0 libiconv version? But no:
$ ./configure --prefix=/usr/lib ... dyld: Library not loaded: /opt/local/lib/libiconv.2.dylib Referenced from: /opt/local/lib/libintl.8.dylib Reason: Incompatible library version: libintl.8.dylib requires version 8.0.0 or later, but libiconv.2.dylib provides version 7.0.0
And I'm still on the old version:
$ /usr/bin/iconv --version iconv (GNU libiconv 1.11)
If I simply try to use MacPorts to uninstall iconv:
$ sudo port uninstall iconv
There is no message, so it seems that it worked, but the binary is still there, and I still get the same messages. But that conflicts with this:
$ sudo port upgrade iconv Error: iconv is not installed $ sudo port install iconv Error: Port iconv not found
I have experimented with the DYLD_LIBRARY_PATH and DYLD_FALLBACK_LIBRARY_PATH environment variables in my ~/.profile. I get errors either way, right now they are commented out.
Perhaps this would be enough information for a possible solution, but I'll give some more info here just in case.
- I have updated my MacPorts very recently (selfupdate and upgrade outdated).
- System architecture is x86-64
- Another error message when I try to open Sublime Edit 2 from the command line:
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 in /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO Trace/BPT trap: 5
$ otool -L /opt/local/lib/libJPEG.dylib /opt/local/lib/libJPEG.dylib: /opt/local/lib/libjpeg.9.dylib (compatibility version 11.0.0, current version 11.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0) $ otool -L /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO | grep "libJPEG*" /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libJPEG.dylib (compatibility version 1.0.0, current version 1.0.0)
No libJPEG.dylib on /usr/lib.
Thanks for reading this far! :)