Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I compiled a package for Solaris 11 Express that has some library dependencies, which I also compiled from source and installed in the usual /usr/local. (And Solaris doesn't even have /usr/local pre-created!) So, my program runs correctly, but I have to run it with

LD_LIBRARY_PATH=/usr/local/lib ./myprogram

or it complains that it couldn't find libsomething.so.

How do I include /usr/local/lib in the library search path, system-wide? Linux has /etc/ld.so.conf -- Solaris doesn't.

share|improve this question
"And Solaris doesn't even have /usr/local pre-created!" Why would it ? This directory violates the SVR4 file system standard. "man filesystem" for details. – jlliagre Jan 15 '11 at 9:30
up vote 4 down vote accepted

Check out the section about setting up the linker: http://bwachter.lart.info/solaris/solfaq.html

You want the crle command.

share|improve this answer
When you cite an external source, it's a good idea to put the gist of it in your post, in case the link disappears. – Gilles Jan 10 '11 at 21:14
@Gilles: Good point. I'll remember that in the future. Thanks – Mark Loeser Jan 10 '11 at 21:43
"crle" is both risky and somewhat overkill as the binary won't work out of the box on other OS instances unless you run crle on all of them. The recommended way is to set the run path in one or other methods suggested in the other reply. – jlliagre Jan 19 '11 at 13:46

If it's acceptable for you, you can set a library search path when compiling (more precisely, when linking). Pass the -rpath option to ld, or tell the compiler to do so, e.g.

gcc -Wl,-rpath,/usr/local/lib
share|improve this answer
Equivalently, set LD_RUN_PATH=/usr/local/lib when compiling. – ephemient Jan 11 '11 at 0:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.