Subject: pkg/22052: mk/buildlink2/fake-la: support for GNU ld scripts (e.g. Linux)
To: None <gnats-bugs@gnats.netbsd.org>
From: None <joachim@handshake.de>
List: netbsd-bugs
Date: 07/04/2003 10:01:27
>Number: 22052
>Category: pkg
>Synopsis: mk/buildlink2/fake-la: support for GNU ld scripts
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: pkg-manager
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Fri Jul 04 07:54:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Joachim Koenig-Baltes
>Release: Suse Linux 8.2 Professional
>Organization:
>Environment:
Linux version 2.4.20-4GB-athlon (root@Athlon.suse.de) (gcc version 3.3
20030226 (prerelease) (SuSE Linux)) #1 Mon Mar 17 17:56:47 UTC 2003
>Description:
newer versions of Linux ship with gcc 3.3 which support GNU ld link scripts
for shared object libraries. E.g. the content of /usr/lib/libpthread.so on
Suse 8.2 Professional is like this:
/* GNU ld script
Use the shared library, but some functions are only in
the static library, so try that secondarily. */
OUTPUT_FORMAT(elf32-i386)
GROUP ( /lib/libpthread.so.0 /usr/lib/libpthread_nonshared.a )
fake-la has to determine a version number for /usr/lib/libpthread.so when
building packages that require libpthread, so fake-la sould be able to
parse such files.
>How-To-Repeat:
% cd pkgsrc/devel/glib2
% bmake
and see it fail in determining the libpthread version number
>Fix:
The following patch expands my already commited previous enhancement to
fake-la, that addressed logical links for libraries by a parsing capability
for GNU ld scripts:
--- fake-la.orig 2003-06-20 10:24:09.000000000 +0200
+++ fake-la 2003-07-04 09:27:07.000000000 +0200
@@ -24,13 +24,20 @@
case $libname in
*.so)
- # no version in name which happens e.g. for libpthread.so on Linux
- # Suse 8.1, Slackware 8.1 and others, but there, the library is a link
- # to a library with a version in it
+ # no version in name which happens e.g. for libpthread.so on
+ # Linux
libbase=`${ECHO} $libname | ${SED} -e "s/\.so$//"`
if ${TEST} -h $reallib; then
+ # library is a link to library with a version in it,
+ # e.g. on Suse 8.1, Slackware 8.1 and others
liblinked=`ls -l $reallib | ${AWK} '{print $NF}'`
version=`${ECHO} $liblinked | ${SED} -e "s/.*\.so\.//;s/\./:/g"`
+ elif ${TEST} -f $reallib; then
+ # ordinary file could be a GNU ld link script
+ # (e.g. /usr/lib/libpthread.so on Suse 8.2)
+ # so filter out first element of GROUP directive
+ liblinked=`${AWK} '/^GROUP/ {print $3}' < $reallib`
+ version=`${ECHO} $liblinked | ${SED} -e "s/.*\.so\.//;s/\./:/g"`
else
# bail out
${ECHO} "could not determine version of $reallib"
Joachim
>Release-Note:
>Audit-Trail:
>Unformatted: