Subject: Re: misc/5213: problems with ar and ld.
To: None <>
From: Todd Vierling <tv@NetBSD.ORG>
List: netbsd-bugs
Date: 03/26/1998 15:36:36
On Thu, 26 Mar 1998 wrote:

: 	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.

: 	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...

Solaris is obvious: it does an automatic ranlib on every invocation of ar.
(I think all SVR4-derived systems do, but I'm not sure.)  Why SunOS 4 has no
problem I don't know; do you have /usr/5bin in your $PATH when compiling
there?  SunOS 4 actually documents this as we do: you need to run ranlib,
unless you use /usr/5bin/ar, which does the SVR4 thing of running ranlib

It's documented behavior that you need to run ranlib on an ar file before
using it for linking if it has been modified or newly created.  This is
normal on lots of BSD-derived systems, not just NetBSD.  The fix?  Run
ranlib after collimating sources into an archive as so:

	-ranlib libname.a

The `-' ignores the return code in case the system in question has no ranlib

-- Todd Vierling (Personal; Bus.