Several questions about libtool
Hello, I'm sad when I hear people rant about libtool, and I would like to know the answers to that rants. The following bugs were, as I supposed, known for years, but I may be wrong - perhaps they were resolved years ago or they were never filed. I would be very grateful if you could give me quick hints about what is the real status of each of the issue. (If my questions are silly, please be patient with me and help me by referring me to the right docs.) 1) .la file always contains the recursively evaluated list of libraries. While this is necessary for static linking and dumb dynamic linkers, it is an issue for dyn. linkers that can do recursive resolution (which is the case on GNU/Linux distributions for many years). (I believe that the rule that forbids packing .la files to -dev and -devel subpackages on Debian and Fedora (respectively), is there just to work around this problem.) 2) People told me libtool is slow and shell has to parse huge script just to find out that it has to call gcc twice, with and without -fPIC. Again, this is not about the general portability case, it is a request for optimization on GNU/Linux platform, that they percepts as one of the major customers of libtool. 3) Does it happen often in practice that a project builds both -fPIC and non-pic objects, even though only one of them is going to be used? If yes, and if it is because of a mistake on package maintainer's side, can something be done about it? (warnings, changed defaults, autodetection in automake) Regards, Stepan Kasal ___ https://lists.gnu.org/mailman/listinfo/libtool
Re: Several questions about libtool
On 01/06/2012 11:21 AM, Stepan Kasal wrote: 1) .la file always contains the recursively evaluated list of libraries. While this is necessary for static linking and dumb dynamic linkers, it is an issue for dyn. linkers that can do recursive resolution (which is the case on GNU/Linux distributions for many years). (I believe that the rule that forbids packing .la files to -dev and -devel subpackages on Debian and Fedora (respectively), is there just to work around this problem.) This is still an issue, libtool always adds all dependencies. Many packages assume this and don't explicitly add required dependencies to Makefile.am etc. I don't recall the arguments for not changing this when building shared. IIRC Scott tried to include Debian's patch at some point. I'll look it up in the archives later. 2) People told me libtool is slow and shell has to parse huge script just to find out that it has to call gcc twice, with and without -fPIC. Again, this is not about the general portability case, it is a request for optimization on GNU/Linux platform, that they percepts as one of the major customers of libtool. Libtool is faster than it used to be, the shell does have to parse quite a bit of script, but compile mode has been moved as close to the beginning of the script as possible to reduce that time, and the number of forks has been reduced drastically for modern shells. I believe dash and ksh93 are faster than bash at running libtool. Last time I checked, libtool's compile mode wasn't significantly slower than using dolt (http://dolt.freedesktop.org/). 3) Does it happen often in practice that a project builds both -fPIC and non-pic objects, even though only one of them is going to be used? If yes, and if it is because of a mistake on package maintainer's side, can something be done about it? (warnings, changed defaults, autodetection in automake) Perhaps the default should be --enable-shared --disable-static? It's worth considering. Peter ___ https://lists.gnu.org/mailman/listinfo/libtool
Re: Several questions about libtool
On Fri, 6 Jan 2012, Peter O'Gorman wrote: This is still an issue, libtool always adds all dependencies. Many packages assume this and don't explicitly add required dependencies to Makefile.am etc. I don't recall the arguments for not changing this when building shared. IIRC Scott tried to include Debian's patch at some point. I'll look it up in the archives later. Some systems (e.g. GNU Linux) add library implicit dependencies at link time while others (e.g. Solaris) only seem to add them at run-time and will fail to link if the dependencies are not also listed. Some systems require that no symbols remain unresolved in order to produce a shared library. Libtool's mode of operation works with static builds and on systems where all libraries have to be supplied at link time. Perhaps the default should be --enable-shared --disable-static? It's worth considering. Each package has control over these defaults. My own package defaults to --disable-shared --enable-static because shared libraries should not link with static libraries. Since a shared build implies more responsibility, I defaulted to the fail-safe option. Bob -- Bob Friesenhahn bfrie...@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/ GraphicsMagick Maintainer,http://www.GraphicsMagick.org/ ___ https://lists.gnu.org/mailman/listinfo/libtool
Re: Several questions about libtool
These questions are quite common, and what they really come down to is that many (or most) users want to solve a *different problem* than the one that Libtool was designed to solve. Libtool will deal with the platform specific vagaries of shared libraries in a uniform manner. It isn't designed to easily expose features of *some* specific shared library implementions, but attempts to support the largest common subset of features. If you have a fairly simple packge that includes libraries, you may be able to build run it on CygWin with no changes (for example), and that is what Libtool was designed to do. Some that you mention below could be dealt with by adding them as new features. On Fri, Jan 6, 2012 at 12:31 PM, Peter O'Gorman pe...@pogma.com wrote: On 01/06/2012 11:21 AM, Stepan Kasal wrote: 1) .la file always contains the recursively evaluated list of libraries. While this is necessary for static linking and dumb dynamic linkers, it is an issue for dyn. linkers that can do recursive resolution (which is the case on GNU/Linux distributions for many years). (I believe that the rule that forbids packing .la files to -dev and -devel subpackages on Debian and Fedora (respectively), is there just to work around this problem.) This is still an issue, libtool always adds all dependencies. Many packages assume this and don't explicitly add required dependencies to Makefile.am etc. I don't recall the arguments for not changing this when building shared. IIRC Scott tried to include Debian's patch at some point. I'll look it up in the archives later. Overlinking when using shared libraries is not a good thing, and Libtool could be modified to have a list of all dependencies for the static case, but when the platform supports it, it could also have a list with only the first level of dependencies. 2) People told me libtool is slow and shell has to parse huge script just to find out that it has to call gcc twice, with and without -fPIC. Again, this is not about the general portability case, it is a request for optimization on GNU/Linux platform, that they percepts as one of the major customers of libtool. Libtool is faster than it used to be, the shell does have to parse quite a bit of script, but compile mode has been moved as close to the beginning of the script as possible to reduce that time, and the number of forks has been reduced drastically for modern shells. I believe dash and ksh93 are faster than bash at running libtool. Last time I checked, libtool's compile mode wasn't significantly slower than using dolt ( http://dolt.freedesktop.org/)**. This could be optimized even more, but it would be a considerable amount of work just to speed up compilation (Shouldn't we be spending more time designeing code instead of building it?). 3) Does it happen often in practice that a project builds both -fPIC and non-pic objects, even though only one of them is going to be used? If yes, and if it is because of a mistake on package maintainer's side, can something be done about it? (warnings, changed defaults, autodetection in automake) Perhaps the default should be --enable-shared --disable-static? It's worth considering. Peter This is the common subset in action. Some platforms can't make static archives from PIC objects, so to make static and shared libraries, each source file must be compiled twice. Users can disable either one at configure time, so Libtool is already doing everything it possibly can to do what it should. Changing the defaults would just cause a different group of users to complain ;) ___ https://lists.gnu.org/mailman/listinfo/libtool
dlopen, DESTDIR, library dependencies and cannot install error
Hi, I'm using libtool-2.4.2. My package includes a dlopen'able module and a shareable library against which it links. Here's the gist of the automake recipe: #--- # exported support routines lib_LTLIBRARIES = liblua_udunits2.la #--- # dlopen'able module luaclib_LTLIBRARIES = udunits2.la udunits2_la_LIBADD = $(UDUNITS2_LIBS) liblua_udunits2.la udunits2_la_LDFLAGS = -module On my system I install into a staging area (/proj/axaf/simul/pkgs) and then use graft (similar to GNU stow) to perform the final installation (to /proj/axaf/simul). The configure command looks like: ./configure --srcdir=/data/pelf1/dj/hd0/axaf/src/lua_udunits2 --prefix=/proj/axaf/simul --exec-prefix=/proj/axaf/simul/x86_64-linux_debian-5.0 and the installation is performed via make AM_MAKEFLAGS=DESTDIR=/proj/axaf/simul/pkgs prefix=/lua_udunits2-0.1.2_01 exec_prefix=/lua_udunits2-0.1.2_01/x86_64-linux_debian-5.0 install This results in a libtool invocation of /bin/sh ../libtool --mode=install /usr/bin/install -c udunits2.la '/proj/axaf/simul/pkgs/lua_udunits2-0.1.2_01/x86_64-linux_debian-5.0/lib/lua/5.1' which fails with: libtool: install: error: cannot install `udunits2.la' to a directory not ending in /proj/axaf/simul/x86_64-linux_debian-5.0/lib/lua/5.1 I believe the problem is that I'm linking the dlopen'able module against a library which hasn't yet been installed (as it is part of the distribution). I haven't been able to distill anything from the libtool documentation which would touches upon this issue. Is this the correct diagnosis and is there a fix? Thanks! Diab ___ https://lists.gnu.org/mailman/listinfo/libtool
Re: Several questions about libtool
Bob Friesenhahn bfrie...@simple.dallas.tx.us writes: On Fri, 6 Jan 2012, Peter O'Gorman wrote: This is still an issue, libtool always adds all dependencies. Many packages assume this and don't explicitly add required dependencies to Makefile.am etc. I don't recall the arguments for not changing this when building shared. IIRC Scott tried to include Debian's patch at some point. I'll look it up in the archives later. Some systems (e.g. GNU Linux) add library implicit dependencies at link time while others (e.g. Solaris) only seem to add them at run-time and will fail to link if the dependencies are not also listed. I don't believe this is correct. GNU/Linux does not add implicit dependencies at link time; it only links with the libraries that you explicitly list. ELF doesn't require that all symbols be resolved during the link, only the symbols in the thing that you're linking. This behavior is, so far as I know, the same on both GNU/Linux and on Solaris. On an ELF system, if linking fails, that means that what you're trying to link references symbols in a library that you're not including, not that one of the libraries that you link against has unreferenced symbols. ELF build-time linkers should not care about the latter; that's handled by the runtime loader. Some systems require that no symbols remain unresolved in order to produce a shared library. This refers only to the binary or shared library itself, not by symbols used by shared libraries that it depends on. Libtool's mode of operation works with static builds and on systems where all libraries have to be supplied at link time. Of which there are very few still in existence in terms of widespread use, since most systems now use ELF or (like Mac OS X) some other object format that doesn't require this. Solaris is definitely not one of them. I believe you may still need this on such platforms as AIX or HP-UX that use a much different object format, but I'm not at all certain of that; it's been years since I've used them. -- Russ Allbery (r...@stanford.edu) http://www.eyrie.org/~eagle/ ___ https://lists.gnu.org/mailman/listinfo/libtool
Re: Several questions about libtool
Russ Allbery r...@stanford.edu writes: I don't believe this is correct. GNU/Linux does not add implicit dependencies at link time; it only links with the libraries that you explicitly list. ELF doesn't require that all symbols be resolved during the link, only the symbols in the thing that you're linking. And, I should add, it's not necessarily the case that even this is required, although that varies. The default on GNU/Linux is to not care about unresolved symbols in shared libraries (but to care about them in executables). So you can generate a shared library that can't be used without linking with other shared libraries. But this is certainly not good practice; the behavior is there to support dynamically loadable modules that should have unresolved symbols that are resolved by the binary that's loading them, such as Apache modules. Shared libraries should always be linked with all libraries that they use *directly* (and should never be linked with libraries that they use only indirectly) on ELF systems with proper run-time linker support for transitive NEEDED (which I believe is all of them in common use). -- Russ Allbery (r...@stanford.edu) http://www.eyrie.org/~eagle/ ___ https://lists.gnu.org/mailman/listinfo/libtool
Re: Several questions about libtool
On 01/06/2012 12:31 PM, Peter O'Gorman wrote: On 01/06/2012 11:21 AM, Stepan Kasal wrote: 1) .la file always contains the recursively evaluated list of libraries. While this is necessary for static linking and dumb dynamic linkers, it is an issue for dyn. linkers that can do recursive resolution (which is the case on GNU/Linux distributions for many years). (I believe that the rule that forbids packing .la files to -dev and -devel subpackages on Debian and Fedora (respectively), is there just to work around this problem.) This is still an issue, libtool always adds all dependencies. Many packages assume this and don't explicitly add required dependencies to Makefile.am etc. I don't recall the arguments for not changing this when building shared. IIRC Scott tried to include Debian's patch at some point. I'll look it up in the archives later. http://lists.gnu.org/archive/html/libtool/2004-11/msg00455.html http://lists.gnu.org/archive/html/libtool/2004-12/msg00259.html http://lists.gnu.org/archive/html/libtool/2004-12/msg00029.html http://lists.gnu.org/archive/html/libtool/2007-09/msg00017.html And from you, no response given: http://lists.gnu.org/archive/html/libtool/2008-01/msg3.html Peter ___ https://lists.gnu.org/mailman/listinfo/libtool