While compiling some of the stuff I use in 64bit lately, I’ve had another chance to use the wonderful crle tool and to acknowledge once again just how easier it made my life.
Here’s what you can read from man crle:
The crle utility provides for the creation and display of a
runtime linking configuration file. The configuration file
is read and interpreted by the runtime linker, ld.so.1(1),
during process start-up.
The tool does exactly that – it specifies where ld should look first for the necessary libraries as you start any executable.
What would we do without this tool? The answer’s simple:
- we’d have to specify libraries directories implicitly every time we compile something – using -L and -R parameters.
- we’d probably have to use the good old LD_LIBRARY_PATH environment variable, which again specifies where libraries should first be looked at.
Not only it’s not cool because you have to waste time, but if you want someone else to use the program you’d get compiled using the tricks above, this someone would have to follow your steps and do the same – set LD_LIBRARY_PATH to the same values.
But with crle it’s much easier:
to look at the current list of directories used by ld just do this:
solaris$ crle Default configuration file (/var/ld/ld.config) not found Default Library Path (ELF): /lib:/usr/lib (system default) Trusted Directories (ELF): /lib/secure:/usr/lib/secure (system default)
and for 64-bit objects, do it like this:
solaris$ crle -64 Configuration file [version 4]: /var/ld/64/ld.config Default Library Path (ELF): /lib/64:/usr/lib/64:/usr/sfw/lib/64 Trusted Directories (ELF): /lib/secure/64:/usr/lib/secure/64 (system defaultCommand line:crle -64 -c /var/ld/64/ld.config -l /lib/64:/usr/lib/64:/usr/sfw/lib/64
As you can see, adding more directories is quite easy. For instance, if I want to add another library directory of my own, /export/soft/lib/64, this command would help me:solaris$ crle -64 -c /var/ld/64/ld.config -l /lib/64:/usr/lib/64:/usr/sfw/lib/64:/export/soft/lib/64