With the advent of 64-bit Solaris with Solaris 7 and now 8, the use of the environment variable LD_LIBRARY_PATH has become frowned upon, as it can break the management of linking 32-bit and 64-bit executables against different library versions.

Also, in the Linux Operating System, there is a configurable run-time linking system managed through the file and the ldconfig command which leads to a far more efficient means of finding dynamic libraries.

How are we supposed to solve the first point, and does/will Solaris offer us something like the second?


There is a new command and file in Solaris 8 that gives very similar, but better and finer grained, functionality to that seen in Linux. The command is crle(1) and the file is ld.config, which exists in /var/ld for 32-bit executables and /var/ld/64 for 64-bit executables, allowing separate configurations for each.

This new command allows the configuration of dynamic library search paths, cacheing of the locations of dynamic libraries, and the setting of alternate object files for standard libraries, as well as a number of other options - see the manual page for full details.

As an example, the following command:

crle -l /usr/lib -l /usr/local/lib -i /usr/lib -i /usr/local/lib \
  -a /usr/lib/ -o /usr/lib/lwp

has the following effect:

The first is basically a system-wide version of the LD_LIBRARY_PATH environment variable that only effects 32-bit applications. Note that LD_LIBRARY_PATH is still honoured, but it's use is not recommended.

The second means that, rather than search each directory in the library path in turn for each library when it starts up a new executable, can instead simply consult the cache file to find it, speeding up application start times considerably. This offers functionality matching the Linux ldconfig command.

The third example is a simple method to experiment with the new, single level threads library supplied in Solaris 8 which is expected to provide better performance for multithreaded applications, especially on single processor systems.

These are just some of the options available with crle - it is highly recommended that the reader acquaints themselves fully with the crle(1) man page before experimenting with it, and there are many more examples there, too.

KEYWORDS: ld ldconfig crle link LD_LIBRARY_PATH