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.

  • "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
    Commented Jan 15, 2011 at 9:30

2 Answers 2


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

You want the crle command.

  • 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. Commented Jan 10, 2011 at 21:14
  • @Gilles: Good point. I'll remember that in the future. Thanks Commented Jan 10, 2011 at 21:43
  • 2
    "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
    Commented Jan 19, 2011 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
  • 3
    Equivalently, set LD_RUN_PATH=/usr/local/lib when compiling.
    – ephemient
    Commented Jan 11, 2011 at 0:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .