Subject: pkg/18694: buildlink2 fake-la fails on a.out
To: None <gnats-bugs@gnats.netbsd.org>
From: None <itohy@netbsd.org>
List: netbsd-bugs
Date: 10/18/2002 23:39:53
>Number:         18694
>Category:       pkg
>Synopsis:       buildlink2 fake-la fails on a.out
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Oct 18 07:40:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     ITOH Yasufumi
>Release:        NetBSD 1.6F; pkgsrc Oct 16, 2002
>Organization:
>Environment:
System: NetBSD pino.my.domain 1.6F NetBSD 1.6F (PINO) #351: Sat Aug 31 14:32:04 JST 2002 itohy@pino.my.domain:/w/src/sys/arch/i386/compile/PINO i386
Architecture: i386
Machine: i386
OBJECT_FMT=a.out

>Description:
	fake-la doesn't work on a.out environment.
	This is because libtool of a.out directly uses ld for creating shlib,
	and ld returns an error status if no input file is specified.

>How-To-Repeat:
% cd pkgsrc/graphics/gdk-pixbuf
% make
=> Checksum OK for gdk-pixbuf-0.18.0.tar.gz.
===> Extracting for gdk-pixbuf-0.18.0
(snip)
===> Patching for gdk-pixbuf-0.18.0
===> Applying NetBSD patches for gdk-pixbuf-0.18.0
/usr/bin/sed -e 's/gnome-config/x.gnome-config.x/g'  /usr/pkgsrc/graphics/gdk-pixbuf/work.i386/gdk-pixbuf-0.18.0/configure.in >/usr/pkgsrc/graphics/gdk-pixbuf/work.i386/gdk-pixbuf-0.18.0/.tmp &&  /bin/mv /usr/pkgsrc/graphics/gdk-pixbuf/work.i386/gdk-pixbuf-0.18.0/.tmp /usr/pkgsrc/graphics/gdk-pixbuf/work.i386/gdk-pixbuf-0.18.0/configure.in
===> Buildlinking for gdk-pixbuf-0.18.0
ld: no input files
libtool: install: `libintl.la' is not a valid libtool archive
Try `libtool --help --mode=install' for more information.
sed: /usr/pkgsrc/graphics/gdk-pixbuf/work.i386/.buildlink/.tmp/inst/libintl.la: No such file or directory
*** Error code 1

Stop.
make: stopped in /usr/pkgsrc/graphics/gdk-pixbuf
*** Error code 1

Stop.
make: stopped in /usr/pkgsrc/graphics/gdk-pixbuf

>Fix:
	Fake an input file.

Index: bsd.buildlink2.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/buildlink2/bsd.buildlink2.mk,v
retrieving revision 1.41
diff -u -r1.41 bsd.buildlink2.mk
--- bsd.buildlink2.mk	2002/10/13 07:13:42	1.41
+++ bsd.buildlink2.mk	2002/10/18 14:27:09
@@ -944,6 +944,7 @@
 		-e "s|@DIRNAME@|${DIRNAME:Q}|g"				\
 		-e "s|@ECHO@|${ECHO:Q}|g"				\
 		-e "s|@EGREP@|${EGREP:Q}|g"				\
+		-e "s|@ID@|${ID:Q}|g"					\
 		-e "s|@LIBTOOL@|${BUILDLINK_LIBTOOL:Q}|g"		\
 		-e "s|@MKDIR@|${MKDIR:Q}|g"				\
 		-e "s|@MV@|${MV:Q}|g"					\
Index: fake-la
===================================================================
RCS file: /cvsroot/pkgsrc/mk/buildlink2/fake-la,v
retrieving revision 1.1
diff -u -r1.1 fake-la
--- fake-la	2002/09/18 00:46:59	1.1
+++ fake-la	2002/10/18 14:27:09
@@ -7,6 +7,7 @@
 CP="@CP@"
 DIRNAME="@DIRNAME@"
 ECHO="@ECHO@"
+ID="@ID@"
 LIBTOOL="@LIBTOOL@ --quiet"
 MKDIR="@MKDIR@"
 MV="@MV@"
@@ -34,7 +35,17 @@
 	esac
 	${MKDIR} $tmpdir/inst
 	cd $tmpdir
-	${LIBTOOL} ${CC} -o $libbase.la -rpath $tmpdir/inst -version-info $version
+
+	# libtool with no input files may cause ld failure
+	echo 'int i;' >foo.c
+	${LIBTOOL} --mode=compile ${CC} -c foo.c
+	${LIBTOOL} ${CC} -o $libbase.la -rpath $tmpdir/inst -version-info $version foo.lo
 	${LIBTOOL} --mode=install ${CP} $libbase.la $tmpdir/inst >/dev/null
+
+	# libtool --mode=install executes ldconfig to add the destination dir.
+	# This is probably no harm but re-run ldconfig just in case.
+	case "`${ID} -u`" in
+	0)	/sbin/ldconfig;;
+	esac 2>/dev/null
 fi
 ${SED} -e "s,$tmpdir/inst,$realdir,g" $tmpdir/inst/$libbase.la
>Release-Note:
>Audit-Trail:
>Unformatted: