DOCUMENT ID:  1151-02

SYNOPSIS:     A script to find symbol definitions in libraries

OS RELEASE:   

PRODUCT:      Solaris x86

KEYWORDS:     undefined symbols building linking script library


DESCRIPTION:

It is difficult resolving undefined symbols when building executable
programs.  The searching through libraries one at a time or "hit and
missing" building can be very time consuming.  This script automates the
library search process. 


SOLUTION:

Here is a script that searches each of a selected set of libraries:


----------------------------cut here -------------------------------
# !/bin/sh
# find symbol references in libraries /lib and /usr/lib are searched
#
xlib=lib
xfile=/tmp/st$$.tmp
# libraries to be searched
for xlib in /lib /usr/lib
do
        cd $xlib
        pwd
# search each library
        for i in lib*.a
                do
                nm $i | grep $1 | grep FILE >$xfile
                if [ -s $xfile ]; then
                echo $xlib/$i
                cat $xfile
                fi
        done
done
rm $xfile
---------------------------script end-------------------------------


Script Documentation:


Installation:

The script should be extracted and installed in a directory commonly
used during development activities under the name "findsym".  I.E. 
/usr/local/bin or /usr/sbin .  The script may be modified to include
additional libraries in the search. 

       Usage:

       To locate "strcmp" the script is invoked:

       findsym strcmp

       Sample output:

/lib/libc.a
[1]      |    0|     0|FILE |LOCL |0    |ABS  |strcmp.s
/lib/libc.a
[1]      |    0|     0|FILE |LOCL |0    |ABS  |strcmp.s


DATE APPROVED: 10/10/95