pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/51311: libtool fails to build shared libraries



>Number:         51311
>Category:       pkg
>Synopsis:       libtool fails to build shared libraries
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          support
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 04 22:30:00 +0000 2016
>Originator:     Francis Dupont
>Release:        7.0.1
>Organization:
Internet Systems Consortium
>Environment:
7.0.1 amd64 aka x86_64
>Description:
On a fresh NetBSD 7.0.1 amd64/x86_64 VM with last auomake, autoconf and libtool packages installed from http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/x86_64/7.0.1/All when I try to build a shared library libtool returns:
*** Warning: linker path does not have real file for library -lgcc
and finally fails to build the shared library. Note it works fine on 6.1.5.

I investigated to find the reasons of the problem:
 - on 6.1.5 the compiler (g++) uses for system libraries "-lgcc -lc -lgcc", on 7.0.1 it uses a more complex sequence with -lgcc, -lgcc_s and --as-needed. Just tries "g++ -v" on some c++ input.

 - on 7.0.1 the gcc libraries are libgcc.a and libgcc_s.so, there is no libgcc_s.a nor libgcc.so.

 - autoconf produces configure files with for$host_os matching netbsd*:
    # Workaround some broken pre-1.5 toolchains
    output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'

 - so when configure sets the config variables at the end of libtool I get in postdeps the system libraries (-lgcc and -lgcc_s). As there is no libgcc.so available libtool raises the warning, etc. 6.1.5 works because of the sed in configure...

I tried with success two solutions:
 - remove the extra system libraries from postdeps in libtool or postdeps_CXX in config.status

 - allows libtool to link a .a into a shared library: set to yes allow_libtool_libs_with_static_runtimes in libtool or enable_shared_with_static_runtimes_CXX in config.status

You can find more details at http://kea.isc.org/wiki/SystemNotesNetBSD
(as a Kea developer and a NetBSD user for more than 20 years I wanted to help people to build Kea on NetBSD, unfortunately with mixed results...)
>How-To-Repeat:
$ echo 'int main() { return 0; }' > sample.cc
$ g++ -v -o sample sample.cc

This shows the system library setup used by g++ in the last/ld line.

After if you'd like to do the same than me:
install automake, libtool, pkg-config, log4cplus, boost and git packages.
Get kea sources, configure and launch make:
$ git clone https://github.com/isc-projects/kea.git
$ cd kea
$ autoreconf -i
$ ./configure
$ make

You should get very quickly the full warning for libtool and it stops some time later.

I recommend you build a smaller (in particular for dependencies) example.
>Fix:
Contact the autoconf and/or libtool core team to find the best way to cleanup this mess. And if possible this time avoid something like the "Workaround some broken pre-1.5 toolchains"...


Home | Main Index | Thread Index | Old Index