Tuesday, July 9, 2013

Why LD_LIBRARY_PATH is bad

If you ever get an idea to do something like this:
$ export LD_LIBRARY_PATH="something"

You should know that LD_LIBRARY_PATH was not intended to be used this way. One typical use case for LD_LIBRARY_PATH is to load a shared library needed by a particular program. This can be dealt with via a simple wrapper:

#!/bin/bash
( LD_LIBRARY_PATH="something" ; /path/to/program )

For an in-depth examination of LD_LIBRARY_PATH, refer to David Barr's article "Why LD_LIBRARY_PATH is bad".

No comments:

Post a Comment