Subject: misc/5213: problems with ar and ld.
To: None <gnats-bugs@gnats.netbsd.org>
From: None <larson@net.com>
List: netbsd-bugs
Date: 03/26/1998 11:07:52
>Number:         5213
>Category:       misc
>Synopsis:       problems with ar and ld.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    misc-bug-people (Misc Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 26 11:20:00 1998
>Last-Modified:
>Originator:     Alan Larson
>Organization:
	Not much, but at N.E.T.
>Release:        1.3.1<NetBSD-current source date>
>Environment:
	mac IIci, netbsd 1.3.1.
	

System: NetBSD alan 1.3.1 NetBSD 1.3.1 (GENERIC) #0: Mon Mar 16 23:10:27 CST 1998 scottr@fx1:/amd/polka/a/src/sys/arch/mac68k/compile/GENERIC mac68k


>Description:
	Building elle produces a library file that contains several
	modules that are not found by the loader.  Running ranlib
	makes the loader happy, but later replacement gets a format
	error message.
>How-To-Repeat:
	Please contact me soon to get a copy of the elle directory
	so you can do this stuff yourself.
>Fix:
	My fix for the problem is to not use netbsd.  SunOS and Solaris
	have no problem with this.  Doesn't work very well for the Mac,
	though...


MORE:


  When building a program (as shown below), the link fails
to find a module that is definitely there.  Running ranlib
causes the ld to work.

  This should not be necessary, as it is not needed on any
other Unix system.

  I suspect that ar is not properly building the archive
file.


  Side note: After building the application by invoking ranlib
as mentioned below, replacing a cingle module resulted in other
complaints about the file format from ld.


  If someone asks soon enough, I can tar up the entire directory
and send them the whole thing to try on their system.


	Alan





make -f makecf.rl -f makecf.fun -f Makefile B-elle
cc -c -O eemain.c
ar rv elib.a eemain.o
ar: creating archive elib.a
a - eemain.o
cc -c -O eecmds.c
ar rv elib.a eecmds.o
a - eecmds.o
cc -c -O eesite.c
ar rv elib.a eesite.o
a - eesite.o
cc -c -O eevini.c
ar rv elib.a eevini.o
a - eevini.o
cc -c -O eedisp.c
ar rv elib.a eedisp.o
a - eedisp.o
cc -c -O eeterm.c
ar rv elib.a eeterm.o
a - eeterm.o
cc -c -O eeerr.c
ar rv elib.a eeerr.o
a - eeerr.o
cc -c -O eeques.c
ar rv elib.a eeques.o
a - eeques.o
cc -c -O eebuff.c
ar rv elib.a eebuff.o
a - eebuff.o
cc -c -O eefile.c
ar rv elib.a eefile.o
a - eefile.o
cc -c -O eefed.c
ar rv elib.a eefed.o
a - eefed.o
cc -c -O eeedit.c
ar rv elib.a eeedit.o
a - eeedit.o
cc -c -O eebit.c
ar rv elib.a eebit.o
a - eebit.o
cc -c -O eef1.c
ar rv elib.a eef1.o
a - eef1.o
cc -c -O eef2.c
ar rv elib.a eef2.o
a - eef2.o
cc -c -O eefd.c
ar rv elib.a eefd.o
a - eefd.o
cc -c -O eehelp.c
ar rv elib.a eehelp.o
a - eehelp.o
cc -c -O eekmac.c
ar rv elib.a eekmac.o
a - eekmac.o
cc -c -O eef3.c
ar rv elib.a eef3.o
a - eef3.o
cc -c -O eesrch.c
ar rv elib.a eesrch.o
a - eesrch.o
cc -c -O eequer.c
ar rv elib.a eequer.o
a - eequer.o
cc -c -O eefill.c
ar rv elib.a eefill.o
a - eefill.o
cc -c -O eediag.c
ar rv elib.a eediag.o
a - eediag.o
make -f sbmake sbnoran
cc -c -O sbstr.c
ar rv libsb.a sbstr.o
ar: creating archive libsb.a
a - sbstr.o
cc -c -O sbvall.c
ar rv libsb.a sbvall.o
a - sbvall.o
cc -c -O sbm.c
ar rv libsb.a sbm.o
a - sbm.o
cc -c -O sberr.c
ar rv libsb.a sberr.o
a - sberr.o
cc -c -O sbbcpy.c
rm -f a.out bnull.c bnull.o bfind.c bfind.o bfind
echo "sbm_null(){}"     > bnull.c
cc -c bnull.c
echo "main(){exit(0);bcopy();}" > bfind.c
cc -o bfind bfind.c
sh -c "if ./bfind; then echo Using system bcopy; (mv bnull.o sbbcpy.o) else echo Using SB bcopy; fi"
Using system bcopy
rm -f bfind bfind.c bfind.o a.out bnull.c bnull.o
ar rv libsb.a sbbcpy.o
a - sbbcpy.o
echo libsb.a
libsb.a
echo elib.a
elib.a
cc -i -o xelle -u _main elib.a libsb.a -ltermlib -lcompat
eefill.o: Undefined symbol `_chballoc' referenced from text segment
eefill.o: Undefined symbol `_chbis' referenced from text segment
eefill.o: Undefined symbol `_chbit' referenced from text segment
sbstr.o: warning: mktemp() possibly used unsafely, consider using mkstemp()
*** Error code 1

Stop.
*** Error code 1

Stop.


  -- > at this point, I run ranlib, and re-run the makefile.


make -f makecf.rl -f makecf.fun -f Makefile B-elle
make -f sbmake sbnoran
echo libsb.a
libsb.a
echo elib.a
elib.a
cc -i -o xelle -u _main elib.a libsb.a -ltermlib -lcompat
sbstr.o: warning: mktemp() possibly used unsafely, consider using mkstemp()
>Audit-Trail:
>Unformatted: