NetBSD Problem Report #14353

Received: (qmail 22050 invoked from network); 25 Oct 2001 14:58:05 -0000
Message-Id: <20011025145748.4E20A11112@www.netbsd.org>
Date: Thu, 25 Oct 2001 07:57:48 -0700 (PDT)
From: witek@pd37.warszawa.sdi.tpnet.pl
Sender: nobody@netbsd.org
Reply-To: witek@pd37.warszawa.sdi.tpnet.pl
To: gnats-bugs@gnats.netbsd.org
Subject: libtool builds incorrect C++ shared libraries
X-Send-Pr-Version: www-1.0

>Number:         14353
>Category:       pkg
>Synopsis:       libtool builds incorrect C++ shared libraries
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    skrll
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Oct 25 14:59:00 +0000 2001
>Closed-Date:    Fri Oct 26 07:48:44 +0000 2001
>Last-Modified:  Fri Oct 26 07:48:44 +0000 2001
>Originator:     Witold J. Wnuk
>Release:        1.5Y
>Organization:
>Environment:
NetBSD tamjee.wnuk.eu.org 1.5Y NetBSD 1.5Y (TAMJEE) #32: Wed Oct 24 10:51:25 CEST 2001     witek@tamjee.wnuk.eu.org:/usr/src/sys/arch/i386/compile/TAMJEE i386
>Description:
It is possible that this problem manifests itself only with -current.

ltcf-cxx.sh (libtool configuring script) uses following command to check how cc invokes linker (and which default libraries, objects or paths it uses)

output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'

However, at least with -current:

> cc -shared -v conftest.o
Using builtin specs.
gcc version 2.95.3 20010315 (release)
 /usr/libexec/collect2 -m elf_i386 -shared /usr/lib/crtbeginS.o conftest.o /usr/lib/crtendS.o

Obviously, there is no -L.

>How-To-Repeat:
Kompile ;-) KDE2 and watch some programs (eg. knotify, kcmshell) mysteriously crash. This is because libtool will invoke c++ -shared -nostdlib without including /usr/lib/crtbeginS.o which will result with global objects being not initialized in the library.

Inspect installed /usr/pkg/bin/libtool, checking second definition of
predep_objects. Correcty it should read "/usr/lib/crtbeginS.o" and not "". Same with postdep_objects.


>Fix:
I propose looking for conftest.$objext instead of -L. It will probably work on all other platforms and so should be submited to libtool authors.

The line would read:
output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'


Patch to /usr/pkgsrc/devel/libtool/patches/patch-ag:

---- CUT ----
diff -u patches/patch-ag.orig patches/patch-ag
--- patches/patch-ag.orig       Thu Oct 25 16:05:34 2001
+++ patches/patch-ag    Thu Oct 25 16:05:37 2001
@@ -2,6 +2,15 @@

 --- ltcf-cxx.sh.orig   Wed May 23 05:05:06 2001
 +++ ltcf-cxx.sh
+@@ -106,7 +106,7 @@
+   # Commands to make compiler produce verbose output that lists
+   # what "hidden" libraries, object files and flags are used when
+   # linking a shared library.
+-  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep "\-L"'
++  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | egrep conftest.$objext'
+
+ else
+   with_gcc=no
 @@ -383,7 +383,23 @@
      esac
      ;;

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: pkg-manager->skrll 
Responsible-Changed-By: tron 
Responsible-Changed-When: Thu Oct 25 22:22:20 PDT 2001 
Responsible-Changed-Why:  
"libtool" and "kdebase2" are both maintained by Nick Hudson. 
State-Changed-From-To: open->closed 
State-Changed-By: skrll 
State-Changed-When: Fri Oct 26 00:47:45 PDT 2001 
State-Changed-Why:  
Thanks for the report and analysis - you were exactly correct. 
I've committed a fix in line with your suggestion. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.