cvs commit: ports/Mk

Dag-Erling Smørgrav des at
Fri Mar 10 08:58:07 GMT 2006

Ade Lovett <ade at> writes:
> On Mar 07, 2006, at 16:59 , Dag-Erling Smørgrav wrote:
> > .la files are useless on an ELF system
> Cite, please?  Given that around 35% of our libtool-using ports
> already installed .la files prior to this change, as well as
> extensive use of them in Linux and NetBSD's pkgsrc (both of which
> run on ELF-based systems, last time I checked), I'm sure any such
> critical problems would have been found by now.

The purpose of .la files is to record dependencies between libraries.
The ELF format stores these dependencies in the libraries themselves,
so the .la files serve no purpose, and it's actually harmful in some
cases because it hardcodes the path to the .so file, preventing
relocation of the library.

To be specific, let's say you build library A with --prefix=/usr/local
and install it with DESTDIR=/tmp/cross-build (so it ends up in
/tmp/cross-build/usr/local/lib/libA.{so,la}).  Next, you build library
B, which depends on library A, also with --prefix=/usr/local, and with
LD_LIBRARY_PATH set to /tmp/cross-build/usr/local/lib.  Libtool will
find the .la file, but that file has libdir set to /usr/local/lib, so
libtool will run ld with -l/usr/local/lib/, which won't work.
If you remove the .la file, libtool will run ld with -lA instead; ld
will obey your LD_LIBRARY_PATH, and everything will be fine.

Dag-Erling Smørgrav - des at

More information about the cvs-ports mailing list