Saturday 7 April 2012

DYLD_LIBRARY_PATH error when running gedit in OS X

Problem:

When running gedit once, I got the following error:

dyld: Library not loaded: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib
Referenced from: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/vecLib
Reason: Incompatible library version: vecLib requires version 1.0.0 or later, but libLAPACK.dylib provides version 0.0.0

Solution:

It turns out that something I had been working on earlier had set the environment variable DYLD_LIBRARY_PATH. To verify this, in Terminal the command printenv was used (specifically, printenv | grep DYLD*). This command yielded 'DYLD_LIBRARY_PATH=/opt/local/lib', which pointed to some libraries installed by macports.

In order to unset this environment variable, in the terminal just type:

unset DYLD_LIBRARY_PATH

After this variable is unset, try to run your program again and see if it works.

Thoughts:

The reason why having this environment variable set broke programs like gedit was probably because the programs being run would normally use the native libraries that come with OSX (in this case, the Accelerate framework), but because DYLD_LIBRARY_PATH was set, the programs were looking at that path instead for the dynamically linked libraries it needs to run, and unfortunately in my case actually finding some dynamically linked libraries that weren't compatible with the Accelerate framework (see Apple docs) and linking to them.

No comments:

Post a Comment