Subject: lib/5774: libbfd compilation problems
To: None <gnats-bugs@gnats.netbsd.org>
From: ITOH Yasufumi <yasufu-i@is.aist-nara.ac.jp>
List: netbsd-bugs
Date: 07/17/1998 01:16:49
>Number:         5774
>Category:       lib
>Synopsis:       libbfd compilation problems
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people (Library Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 16 09:20:00 1998
>Last-Modified:
>Originator:     ITOH Yasufumi
>Organization:
	Nara Institute of Science and Technology, Nara, Japan
>Release:        1.3F (July 15, 1998)
>Environment:
System: NetBSD acha.my.domain 1.3F NetBSD 1.3F (UVM) #0: Sat Jul 4 18:14:06 JST 1998 itohy@acha.my.domain:/usr/src/sys/arch/x68k/compile/UVM x68k


>Description:
	1. make depend  at  src/gnu/lib/bfd  generates this warning:

% make depend
 (...snip)
/usr/src/gnu/lib/bfd/../../dist/bfd/elf32-m68k.c:1823: elf32-target.h: No such file or directory

	2. make -j 4  (cross compilation on 4CPU machine) at
	   src/gnu/lib/bfd fails with an error like the following,
	   even though you have run  make depend  beforehand.

% make -j 4
--- elf32-m68k.so ---
--- archive.o ---
--- archive.so ---
--- archures.o ---
cc -O  -Werror  -I. -I/usr/src/gnu/lib/bfd -I/usr/src/gnu/lib/bfd/../../dist/bfd -I/usr/src/gnu/lib/bfd/../../dist/opcodes -I/usr/src/gnu/lib/bfd/../../dist/include -nostdinc -idirafter /usr/usr/include -c -fpic -DPIC /usr/src/gnu/lib/bfd/../../dist/bfd/elf32-m68k.c -o elf32-m68k.so
 (...snip)
--- elf32-m68k.so ---
/usr/src/gnu/lib/bfd/../../dist/bfd/elf32-m68k.c:1823: elf32-target.h: No such file or directory
*** Error code 1
1 error

	3. libbfd.c  is unexpectedly archived in the  libbfd.a .

% make -j 1
 (...snip)
building standard bfd library
/usr/src/gnu/lib/bfd/../../dist/bfd/libbfd.c: not object file or archive

>How-To-Repeat:
	See above.

>Fix:
	Apply this patch to src/gnu/lib/bfd .

	1. Add elf{32,64}-target.h to the SRCS macro.

	2. This problem is due to the missing of dependency of *.so.
	   The fix of 1. also fixes 2. with make depend,
	   but the following patch to Makefile (2nd hunk) allows make
	   without make depend, which may be convenient.

	3. An undocumented :-) special target  .INVISIBLE
	   seems usable to solve this.
	   But, I'm not sure this is a correct solution....

diff -u Makefile.orig Makefile
--- Makefile.orig	Fri May 22 20:07:34 1998
+++ Makefile	Thu Jul 16 23:42:00 1998
@@ -73,7 +73,7 @@
 	$(CC_so) $(TDEFAULTS) -c $(.IMPSRC) -o $@
 
 # Avoid the unwanted .c.a default rule
-.NOPATH: libbfd.a
+.INVISIBLE: libbfd.c
 
 # Icky generated header files...
 CLEANFILES+= elf32-target.h elf64-target.h
@@ -90,15 +90,15 @@
 targets.o : targmatch.h
 
 # Make sure we build elf32-target.h when needed.
-elf32-gen.o   : elf32-target.h
-elf32-i386.o  : elf32-target.h
-elf32-m68k.o  : elf32-target.h
-elf32-mips.o  : elf32-target.h
-elf32-ppc.o   : elf32-target.h
-elf32-sparc.o : elf32-target.h
+elf32-gen.o   elf32-gen.so   : elf32-target.h
+elf32-i386.o  elf32-i386.so  : elf32-target.h
+elf32-m68k.o  elf32-m68k.so  : elf32-target.h
+elf32-mips.o  elf32-mips.so  : elf32-target.h
+elf32-ppc.o   elf32-ppc.so   : elf32-target.h
+elf32-sparc.o elf32-sparc.so : elf32-target.h
 
 # Make sure we build elf64-target.h when needed.
-elf64-alpha.o : elf64-target.h
-elf64-gen.o   : elf64-target.h
-elf64-mips.o  : elf64-target.h
-elf64-sparc.o : elf64-target.h
+elf64-alpha.o elf64-alpha.so : elf64-target.h
+elf64-gen.o   elf64-gen.so   : elf64-target.h
+elf64-mips.o  elf64-mips.so  : elf64-target.h
+elf64-sparc.o elf64-sparc.so : elf64-target.h
diff -u _sparc.mk.orig _sparc.mk
--- _sparc.mk.orig	Wed Jul  1 20:09:40 1998
+++ _sparc.mk	Thu Jul 16 16:25:06 1998
@@ -2,7 +2,7 @@
 
 BFD_MACHINES =	cpu-sparc.c
 BFD_BACKENDS =	sparcnetbsd.c sunos.c aout32.c \
-		elf32-sparc.c elf32.c \
+		elf32-target.h elf32-sparc.c elf32.c \
 		elf.c elflink.c
 
 ARCH_DEFS = -DARCH_sparc \
diff -u _alpha.mk.orig _alpha.mk
--- _alpha.mk.orig	Sat Oct 18 21:16:12 1997
+++ _alpha.mk	Thu Jul 16 16:22:21 1998
@@ -1,7 +1,7 @@
 # $NetBSD: _alpha.mk,v 1.2 1997/10/17 20:06:59 gwr Exp $
 
 BFD_MACHINES =	cpu-alpha.c
-BFD_BACKENDS =	elf64-alpha.c elf64.c elf.c elflink.c \
+BFD_BACKENDS =	elf64-target.h elf64-alpha.c elf64.c elf.c elflink.c \
 		coff-alpha.c ecoff.c ecofflink.c
 
 ARCH_DEFS = -DARCH_alpha \
diff -u _m68k.mk.orig _m68k.mk
--- _m68k.mk.orig	Mon Jul 13 20:06:29 1998
+++ _m68k.mk	Thu Jul 16 16:22:57 1998
@@ -2,7 +2,7 @@
 
 BFD_MACHINES =	cpu-m68k.c
 BFD_BACKENDS =	m68knetbsd.c m68k4knetbsd.c sunos.c aout32.c \
-		elf32-m68k.c elf32.c elf.c elflink.c
+		elf32-target.h elf32-m68k.c elf32.c elf.c elflink.c
 
 ARCH_DEFS = -DARCH_m68k \
  -DSELECT_ARCHITECTURES='&bfd_m68k_arch'
diff -u _mips.mk.orig _mips.mk
--- _mips.mk.orig	Sun Oct 19 21:37:49 1997
+++ _mips.mk	Thu Jul 16 16:23:59 1998
@@ -1,8 +1,8 @@
 # $NetBSD: _mips.mk,v 1.7 1997/10/19 10:44:54 jonathan Exp $
 
 BFD_MACHINES =	cpu-mips.c
-BFD_BACKENDS =	elf32-mips.c elf32.c elf.c elflink.c ecofflink.c \
-		 coff-mips.c ecoff.c
+BFD_BACKENDS =	elf32-target.h elf32-mips.c elf32.c elf.c elflink.c \
+		ecofflink.c coff-mips.c ecoff.c
 
 ARCH_DEFS = -DARCH_mips \
  -DSELECT_ARCHITECTURES='&bfd_mips_arch'
diff -u _powerpc.mk.orig _powerpc.mk
--- _powerpc.mk.orig	Sat Oct 18 21:16:20 1997
+++ _powerpc.mk	Thu Jul 16 16:24:34 1998
@@ -1,7 +1,7 @@
 # $NetBSD: _powerpc.mk,v 1.2 1997/10/17 20:07:33 gwr Exp $
 
 BFD_MACHINES =	cpu-powerpc.c
-BFD_BACKENDS =	elf32-ppc.c elf32.c elf.c elflink.c
+BFD_BACKENDS =	elf32-target.h elf32-ppc.c elf32.c elf.c elflink.c
 
 ARCH_DEFS = -DARCH_powerpc \
  -DSELECT_ARCHITECTURES='&bfd_powerpc_arch'
>Audit-Trail:
>Unformatted: