Bug#929396: libtool is unable to link complex projects

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Bug#929396: libtool is unable to link complex projects

Dmitry Mikhirev
Package: libtool
Version: 2.4.6-10
Severity: important

Dear maintainer, I faced a problem trying to build a project,
libtoolized by Buster's libtool. It is also reproducible wit libtool
from Sid. The trouble is that if libfoo.la and libbar.la were built,
where libbar.la depends on libfoo.la, and some binary is linked to
libbar.la, libfoo is not added to the linker command line. If I replace
ltmain.sh and libtool.m4 by the files from the original tarball, I'm
able to build the project successfully.

Steps to reproduce:

1. Get rpm 4.13.1 source tree
    git clone [hidden email]:rpm-software-management/rpm.git
    cd rpm
    git checkout rpm-4.13.1-release
2. Run autoreconf
    autoreconf -fiv
3. Download latest berkeley-db from
http://download.oracle.com/otn/berkeley-db/db-18.1.32.tar.gz (the bug
doesn't reproduce when building with system db package) and untar it:
    tar -xf db-18.1.32.tar.gz
    ln -s db-18.1.32 db
4. Install dependencies
    sudo apt install build-essential libnss3-dev libnspr4-dev libpopt-dev libdb-dev zlib1g-dev libmagic-dev
5. Configure && make
    CPPFLAGS='-I/usr/include/nspr -I/usr/include/nss' ./configure --without-lua --without-python

Expected result: rpm is built successfully.

Actual result:
    /bin/bash ../libtool  --tag=CC   --mode=link gcc  -g -O2 -fPIC -DPIC -D_REENTRANT -Wall -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes  -fno-strict-aliasing -fstack-protector -Wempty-body   -o rpmdb_dump  ../db3/db_dump.o ../db3/util_cache.o ../db3/util_sig.o librpm.la -ldl -lpthread
    libtool: link: gcc -g -O2 -fPIC -DPIC -D_REENTRANT -Wall -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -fno-strict-aliasing -fstack-protector -Wempty-body -o .libs/rpmdb_dump ../db3/db_dump.o ../db3/util_cache.o ../db3/util_sig.o  ./.libs/librpm.so -ldl -lpthread
    /usr/bin/ld: ../db3/db_dump.o: in function `db_init':
    /home/dmitry/src/rpm-github/db3/../db/util/db_dump.c:379: undefined reference to `__db_util_env_open_rpmdb'
    /usr/bin/ld: ../db3/db_dump.o: in function `main':
    /home/dmitry/src/rpm-github/db3/../db/util/db_dump.c:45: undefined reference to `__db_util_arg_progname_rpmdb'
    /usr/bin/ld: /home/dmitry/src/rpm-github/db3/../db/util/db_dump.c:47: undefined reference to `__db_util_version_check_rpmdb'
    /usr/bin/ld: /home/dmitry/src/rpm-github/db3/../db/util/db_dump.c:106: undefined reference to `__db_util_arg_password_rpmdb'
    /usr/bin/ld: /home/dmitry/src/rpm-github/db3/../db/util/db_dump.c:199: undefined reference to `__db_util_env_create_rpmdb'
    collect2: error: ld returned 1 exit status

In the linker command line librmio.so and libdb.so are missing, as well
as -L options specifying path to find them. Both libraries are listed
as dependency_libs in librpm.la.

After looking at Debian patches I assumed that this issue could be
introduced by the link_all_deplibs.patch. Although after reverting it, I
figured out that even librpm.so has disappeared from the linker command
line. So it seems that some another patch breaks the libtool linking
behavior even with link_all_deplibs=unknown.

-- System Information:
Debian Release: 10.0
  APT prefers testing-proposed-updates
  APT policy: (500, 'testing-proposed-updates'), (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, mipsel

Kernel: Linux 4.9.0-9-amd64 (SMP w/4 CPU cores)
Kernel taint flags: TAINT_OOT_MODULE
Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8), LANGUAGE=ru_RU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages libtool depends on:
ii  autotools-dev           20180224.1
ii  clang-3.5 [c-compiler]  1:3.5-10
ii  clang-5.0 [c-compiler]  1:5.0.2~svn328729-1~exp1~20180509123438.100
ii  clang-6.0 [c-compiler]  1:6.0.1-10
ii  clang-7 [c-compiler]    1:7.0.1-8
ii  cpp                     4:8.3.0-1
ii  file                    1:5.35-4
ii  gcc                     4:8.3.0-1
ii  gcc-4.6 [c-compiler]    4.6.3-14
ii  gcc-4.8 [c-compiler]    4.8.4-1
ii  gcc-4.9 [c-compiler]    4.9.2-10
ii  gcc-6 [c-compiler]      6.3.0-18+deb9u1
ii  gcc-8 [c-compiler]      8.3.0-6
ii  libc6-dev [libc-dev]    2.28-10

Versions of packages libtool recommends:
ii  libltdl-dev  2.4.6-9

Versions of packages libtool suggests:
ii  autoconf                         2.69-11
ii  automake [automaken]             1:1.16.1-4
ii  automake1.11 [automaken]         1:1.11.6-5
pn  gcj-jdk                          <none>
ii  gfortran                         4:8.3.0-1
ii  gfortran-8 [fortran95-compiler]  8.3.0-6
ii  libtool-doc                      2.4.6-9

-- no debconf information