Search code examples
linuxautotoolslibtool

libtool adding extra 'U' to .so file names


I have a project built with autotools, divided into two folders; the first one, lib, creates some libraries, and the second one, tools, links against them.
The build fails because libtool renames the libraries as follows while relinking:

mylib.1.0.0 -> mylib.1.0.0U

After the renaming occurs, anyway, the previous name is not restored, nor is a new mylib.1.0.0 created, so the symbolic links like mylib still point to the name without the extra U and the linking fails.
Is there any way to avoid this? or maybe even to avoid the relinking at all? I'm using libtool version 1.5.6.


Solution

  • Apparently I got it...
    The problem is easily reproducible with the following structure:

    • a lib folder, building:
      • liba
      • libb, depending on liba
    • a src folder, building prog, which links libb

    Then you must specify this in lib/Makefile.am:

    lib_LTLIBRARIES = \
        libb.la \
        liba.la
    

    At that point a liba.so.1.0.0U file will be produced. Specifying instead (note that the order of the libraries is changed)

    lib_LTLIBRARIES = \
        liba.la \
        libb.la
    

    the build works fine.
    I agree that specifying things in the correct order is in any case the best thing to do; what is still unclear to me is if this is a libtool bug or not...