[GRASSLIST:3952] Re: error while loading shared libraries

Glynn Clements glynn.clements at virgin.net
Tue Jun 25 14:29:00 EDT 2002


Markus Neteler wrote:


Markus Neteler wrote:

> >          libgd.so => not found
             ^^^^^^^^
> Note that this is a local misconfiguration which is not related to GRASS.

Actually, it's a problem with the PNG driver binary. The reference
should include the major version number, e.g. libgd.so.1.

This problem normally arises from linking against a shared library
which was built by someone who doesn't know how to build shared
libraries correctly (unfortunately, the GD developers appear to fall
into this category, judging from the GD 2.0.x Makefile).

> Excluding /usr/lib and /usr/local/lib from LD_LIBRARY_PATH will also
> cause problems for other programs.

/usr/lib should not be present in $LD_LIBRARY_PATH, and it's debatable
whether /usr/local/lib should be present (but, if it isn't present, it
would need to be in /etc/ld.so.conf instead).

On Linux, the directories in $LD_LIBRARY_PATH are searched *before*
the linker consults /etc/ld.so.cache. For maximum efficiency,
LD_LIBRARY_PATH should be as short as possible, preferably empty.

Directories which should always be checked for libraries should be
listed in /etc/ld.so.conf. This is used by "ldconfig" to generate
ld.so.cache. The loader uses ld.so.cache to locate libraries, but only
after searching $LD_LIBRARY_PATH.

Obtaining an entry from ld.so.cache takes constant time, whereas
searching $LD_LIBRARY_PATH takes longer as more directories are added
to it. This is why it should normally be empty.

The main reasons for using LD_LIBRARY_PATH are:

1. Where a normal user, who can't modify the loader's configuration,
needs to use additional library directories.

2. When additional library directories are necessary in specific
contexts. E.g. $GISBASE/lib is added to LD_LIBRARY_PATH by the GRASS
startup script; the libraries found there aren't useful outside of
GRASS.

3. When you have multiple versions of a library, and you want to force
the use of a specific version at run time (e.g. on my system, the
default libGL is the one from XFree86, but I might set LD_LIBRARY_PATH
to force the use of Mesa's libGL if I want a "second opinion"
regarding unexpected behaviour).

-- 
Glynn Clements <glynn.clements at virgin.net>



More information about the grass-user mailing list