From owner-freebsd-bugs Mon Aug 9 1:22:57 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 7D4D015267 for ; Mon, 9 Aug 1999 01:22:41 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id BAA34391; Mon, 9 Aug 1999 01:20:00 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from karon.dynas.se (karon.dynas.se [192.71.43.4]) by hub.freebsd.org (Postfix) with SMTP id 1B90715177 for ; Mon, 9 Aug 1999 01:20:34 -0700 (PDT) (envelope-from mikko@mt.dynas.se) Received: (qmail 47067 invoked from network); 9 Aug 1999 08:18:47 -0000 Received: from spirit.sto.dynas.se (HELO spirit.dynas.se) (172.16.1.10) by karon.sto.dynas.se with SMTP; 9 Aug 1999 08:18:47 -0000 Received: from mt.dynas.se by spirit.dynas.se with smtp (Smail3.1.28.1 #32) id m11Dkdq-000iT7C; Mon, 9 Aug 99 10:18:46 +0200 Received: (from mikko@localhost) by mt.dynas.se (8.9.3/8.9.3) id KAA06421; Mon, 9 Aug 1999 10:19:48 +0200 (CEST) (envelope-from mikko) Message-Id: <199908090819.KAA06421@mt.dynas.se> Date: Mon, 9 Aug 1999 10:19:48 +0200 (CEST) From: mikko@dynas.se Reply-To: mikko@dynas.se To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/13039: make cannot find archive members Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 13039 >Category: bin >Synopsis: make cannot find archive members >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Aug 9 01:20:00 PDT 1999 >Closed-Date: >Last-Modified: >Originator: Mikko Työläjärvi >Release: FreeBSD 4.0-CURRENT i386 >Organization: >Environment: Any FreeBSD/i386 between 3.1 (the oldest I have tested) and 4.0-CURRENT Fri Aug 6 18:44:10 CEST 1999 >Description: Make no longer properly parses archive files, so using archive members as make targets, as described in PSD:12 section 4.2, does not work. >How-To-Repeat: Create a makefile, building a tiny archive. Type "make" a couple of times, and watch make re-build the last target every time (actually, not if make:ing several times within the same second). mt% echo 'int foo;' > x.c mt% cat > Makefile OBJS = x.o libx.a: libx.a($(OBJS)) ar crs $@ $? mt% make cc -O -pipe -c x.c ar crs libx.a x.o mt% make ar crs libx.a x.o mt% make ar crs libx.a x.o mt% make -dm Examining x.c...modified 9:54:47 Aug 9, 1999...up-to-date. Examining x.o...modified 9:55:19 Aug 9, 1999...up-to-date. Examining libx.a(x.o)...non-existent...modified before source...out-of-date. ^^^^^^^^^^^^- not true... update time: 9:55:26 Aug 9, 1999 Examining libx.a...modified 9:55:23 Aug 9, 1999...library...out-of-date. ar crs libx.a x.o update time: 9:55:26 Aug 9, 1999 Try the same thing with GNU make: mt% gmake gmake: `libx.a' is up to date. You can even remove the object file (as per documentation for pmake): mt% rm x.o mt% gmake gmake: `libx.a' is up to date. >Fix: It looks like "ar" and friends from the GNU binutils build SVR4-ish archives, with the index list in an entry called "/", and the long file name table in one called "//". See the comments in "/usr/src/contrib/binutils/bfd/archive.c" Most of the relevant code is already present in "make" - it is mainly a matter of ifdeffing. For example, like so: diff -ru /usr/src/usr.bin/make/arch.c /tmp/make/arch.c --- /usr/src/usr.bin/make/arch.c Thu Oct 29 19:17:44 1998 +++ /tmp/make/arch.c Mon Aug 9 09:53:40 1999 @@ -118,7 +118,7 @@ static void ArchFree __P((ClientData)); static struct ar_hdr *ArchStatMember __P((char *, char *, Boolean)); static FILE *ArchFindMember __P((char *, char *, struct ar_hdr *, char *)); -#if defined(__svr4__) || defined(__SVR4) +#if defined(__svr4__) || defined(__SVR4) || defined(__ELF__) #define SVR4ARCHIVES static int ArchSVR4Entry __P((Arch *, char *, size_t, FILE *)); #endif @@ -474,7 +474,7 @@ * the comparisons easier... */ cp = strrchr (member, '/'); - if (cp != (char *) NULL) { + if (cp != (char *) NULL && strcmp(member, RANLIBMAG) != 0) { member = cp + 1; } diff -ru /usr/src/usr.bin/make/config.h /tmp/make/config.h --- /usr/src/usr.bin/make/config.h Thu Oct 29 19:17:45 1998 +++ /tmp/make/config.h Mon Aug 9 09:53:06 1999 @@ -114,4 +114,8 @@ # ifndef RANLIBMAG # define RANLIBMAG "__.SYMDEF" # endif +#else +# ifndef RANLIBMAG +# define RANLIBMAG "/" +# endif #endif >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message