Subject: pkg/8669: qt programs using pkglibtool don't work (linker/loader bug?)
To: None <gnats-bugs@gnats.netbsd.org>
From: None <barr@visi.com>
List: netbsd-bugs
Date: 10/23/1999 09:51:05
>Number:         8669
>Category:       pkg
>Synopsis:       programs compiled using pkglibtool against qt (or apparently any pkg C++ library) fail with 'Undefined symbol ""'
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager (NetBSD software packages system bug manager)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 23 09:00:01 1999
>Last-Modified:
>Originator:     David Barr
>Organization:
	
>Release:        -current
>Environment:
System: NetBSD hokey 1.4K NetBSD 1.4K (HOKEY) #0: Mon Oct 4 11:25:13 EDT 1999 root@hokey:/usr/src/sys/arch/sparc/compile/HOKEY sparc


>Description:
	This was reported on current-users.

: hokey:~;which musicbox
/usr/pkg/bin/musicbox
: hokey:~;musicbox
/usr/X11R6/lib/libqt.so.1: Undefined symbol "" (reloc type = 12, symnum = 4)
: hokey:~;ldd /usr/pkg/bin/musicbox
/usr/pkg/bin/musicbox:
         -lstdc++.2 => /usr/lib/libstdc++.so.2
         -lm.0 => /usr/lib/libm.so.0
         -lc.12 => /usr/lib/libc.so.12
         -lqt.1 => /usr/X11R6/lib/libqt.so.1
         -lX11.6 => /usr/X11R6/lib/libX11.so.6
         -lXext.6 => /usr/X11R6/lib/libXext.so.6
         -lossaudio.0 => /usr/lib/libossaudio.so.0

Paul Kranenburg (pk@cs.few.eur.nl) followed up with:
This error seems to pop up with every shared library built from C++
sources by using the `libtool' to construct the link command to
build the library from (PIC) object files.  The generated link command
includes `-lgcc' -- which is a static (non-PIC) library -- that
should preferably not be mixed in with the PIC object files of
the shared library being built.

A solution would be to have libtool use a similar recipe for building
shared libraries as do our native `make' rules, i.e. calling ld(1)
directly with appropriate options.

Unfortunately, reading through the logic of `libtool' feels about the
same as trying to retrieve one's lost contact lenses from a pile of
horse manure..

-pk
>How-To-Repeat:
	Compile, install, run any qt app.  (in my case I tried musicbox)
	It will fail with:
/usr/X11R6/lib/libqt.so.1: Undefined symbol "" (reloc type = 12, symnum = 4)


>Fix:
This seems to me to point to a linker/loader bug, involving the mixing
of PIC and non-PIC code.  Or, as pk says it's simply a bug in pkglibtool
which should use ld(1) instead of g++ to do the linking.
>Audit-Trail:
>Unformatted: