[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gcc-ld woes



Wolfgang Lux wrote:
>Scott Bigham wrote:
>>   - It apparently doesn't scan libraries multiple times, leading to
>>     scads of undefined symbols unless I explicitly put every library on
>>     the command line twice.
>
>Just build your library with "gcc-ar rs" instead of "gcc-ar r", and
>you won't need to give the libraries twice to the linker.

Since what I usually do is compile packages off the net that don't
know about the s option to ar, I wrote this little script a while ago.
Most packages with configure scripts will use ranlib given half a
chance...



#!/bin/sh
#
# ranlib -- create/update a library's symbol table.
#
# Written by cpbs: Sun Mar 05 19:29:14 1995
#
# Usage: ranlib archive...
#
# Result code: 0 if no problems occured
#              1 if error(s) were encountered

error=0

for archive in $*
do
  if ar s $archive ; then
    :
  else
    echo "$0: problem with archive $archive." 1>&2
    error=1
  fi
done

exit $error



--Charles