[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: compiling and installing lib's



glhenni@cs.sandia.gov (Gary L. Hennigan) writes:
| Micha Feigin <michf@math.tau.ac.il> writes:
| | How do i compile both static and non static librarys under C (.a and .so)
| | and how do i install them on the system so they can be found by the linker
| | or programs.
| 
| You just put them in a directory somewhere. Generally /usr/local/lib
| is a good location if you're installing them yourself. 
| 
| Usually it's best to let the developers specify the path explicitly
| for non-standard libraries. They can do this with, on most compilers,
| "-L/usr/local/lib -lfoo". 
[snip]

Sorry to followup to my own post, but I just thought of another
important point. If you have pre-existing executables that are linked
against a shared library you'll need to add the directory where you
installed the shared libraries to /etc/ld.so.conf. For example, add
the line /usr/local/lib if you put lib*.so files in /usr/local/lib.

Or, and this, to me, would be the preferred solution. Have the users
that want to run the executable add the path to their
LD_LIBRARY_PATH. So, for example, in their ~/.profile have them add:

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

See "man ld.so" for further information.

Gary


Reply to: