3

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 Jan 15 '11 at 9:30
4

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. – 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
  • 1
    "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
2

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
  • 2
    Equivalently, set LD_RUN_PATH=/usr/local/lib when compiling. – ephemient Jan 11 '11 at 0:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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