www.delorie.com/gnu/docs/libtool/libtool_12.html   search  
Buy GNU books!


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.5 Installing libraries

Installing libraries on a non-libtool system is quite straightforward... just copy them into place:(3)

burger$ su
Password: ********
burger# cp libhello.a /usr/local/lib/libhello.a

Oops, don't forget the ranlib command:

burger# ranlib /usr/local/lib/libhello.a

Libtool installation is quite simple, as well. Just use the install or cp command that you normally would (see section 4.4 Install mode):

a23# libtool cp libhello.la /usr/local/lib/libhello.la
cp libhello.la /usr/local/lib/libhello.la
cp .libs/libhello.a /usr/local/lib/libhello.a
ranlib /usr/local/lib/libhello.a

Note that the libtool library `libhello.la' is also installed, to help libtool with uninstallation (see section 4.6 Uninstall mode) and linking (see section 3.3 Linking executables) and to help programs with dlopening (see section 9. Dlopened modules).

Here is the shared library example:

burger# libtool install -c libhello.la /usr/local/lib/libhello.la
install -c .libs/libhello.so.0.0 /usr/local/lib/libhello.so.0.0
install -c libhello.la /usr/local/lib/libhello.la
install -c .libs/libhello.a /usr/local/lib/libhello.a
ranlib /usr/local/lib/libhello.a

It is safe to specify the `-s' (strip symbols) flag if you use a BSD-compatible install program when installing libraries. Libtool will either ignore the `-s' flag, or will run a program that will strip only debugging and compiler symbols from the library.

Once the libraries have been put in place, there may be some additional configuration that you need to do before using them. First, you must make sure that where the library is installed actually agrees with the `-rpath' flag you used to build it.

Then, running `libtool -n --finish libdir' can give you further hints on what to do (see section 4.5 Finish mode):

burger# libtool -n --finish /usr/local/lib
PATH="$PATH:/sbin" ldconfig -m /usr/local/lib
Libraries have been installed in:

To link against installed libraries in a given directory, LIBDIR,
you must use the `-LLIBDIR' flag during linking.

 You will also need to do one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-RLIBDIR' linker flag

See any operating system documentation about shared libraries for
more information, such as the ld and ld.so manual pages.

After you have completed these steps, you can go on to begin using the installed libraries. You may also install any executables that depend on libraries you created.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003