1832891 Members
2394 Online
110048 Solutions
New Discussion

Re: linking problem

 
andi_1
Frequent Advisor

linking problem

Hi guys,

I am trying to build httpd binary and I get the following undefined symbols.

/usr/ccs/bin/ld: (Warning) At least one PA 2.0 object file (buildmark.o) was detected. The linked output may not run on a PA 1.x system.
/usr/ccs/bin/ld: Unsatisfied symbols:
__eprintf (code)
__udivdi3 (code)
__umoddi3 (code)
*** Error exit code 1

How can I find out where are those symbols are coming from? (nm -p doesn't give this information)

Also, is it possible to remove the above symbols from the generated binary file? The file is actually generated even though errors were encountered. When use the file, it core-dumps.

Thank you.

4 REPLIES 4
A. Clay Stephenson
Acclaimed Contributor

Re: linking problem

Hi:

Let me give you my standard method for finding where these symbols are defined.

1) Cd to desired library directly, e.g. /usr/lib

2) nm lib* > /tmp/list

3) Search /tmp/list using grep or vi for your symbols. The file name listed immediately above these symbols (which may be only a few lines above or many lines above) will be the library that you need to include in your link.
If it ain't broke, I can fix that.
Olav Baadsvik
Esteemed Contributor

Re: linking problem

Hi,

Here is a script I use to find where
a symbol is defined. It uses the
odump command. You will understand how
to use it by trying it (and reading the
script)

It comes as an attachment as I am afraid
lines will be messed up otherwise.

Olav
Olav Baadsvik
Esteemed Contributor

Re: linking problem


Hi again.

Seems I did not get the script attached.
Try to include it here:

#!/bin/ksh
#
# Filename: /home/olav/scripts/findsym
#
#
# DESCRIPTION:
# This scripts runs through files in a given directory searching
# for a given symbol.
#
# It uses the odump command
# (not suported under hp-ux 10.x, but is found in the
# filset USRCONTRB. No man-page on 10.x
# Supported under hp-ux 11.x (with man-page)
#
#
# WRITTEN BY:
# This is an unsupported script written by:
# Olav Baadsvik 12/4-94
#
#
#
# Last modified:16/10-01
#
SCRIPT_NAME=`basename $0`
# 10.20 ODUMPPATH=/usr/contrib/bin
ODUMPPATH=/usr/ccs/bin

REQ_ARGUMENTS=3 # minumum number of arguments required
MAX_ARGUMENTS=3 # maximum number of arguments

print_usage()
{
echo ""
echo "Usage:"
echo " $SCRIPT_NAME directory extension symbol"
echo " "
echo " directory - directory to search in."
echo " extension - checks files matching *.extension"
echo " extension will normally be one of sl, o, a, 1, 2"
echo " symbol - symbol to search for"
echo ""
echo " Example of use:"
echo " $SCRIPT_NAME /usr/lib sl xdr_char"
echo ""
echo " An OB-product"
echo ""
}


##########################################################
# Section for testing of arguments

if [ $# -lt $REQ_ARGUMENTS -o $# -gt $MAX_ARGUMENTS ]
then
echo ""
echo "Wrong number of arguments"
echo "Minimum number of arguments: $REQ_ARGUMENTS"
echo "Maximum number of arguments: $MAX_ARGUMENTS"
print_usage
exit 1
fi

if [ ! -d $1 ]
then
echo ""
echo "$1 is not a directory"
print_usage
exit 1
fi

# end of section for testing arguments
#########################################################


STARTDIR=$1
cd $STARTDIR
filer=`ls -d *.$2 2> /dev/null`
if [ $? -ne 0 ]
then
echo ""
echo "No .$2-files found in $STARTDIR"
echo ""
print_usage
exit 1
fi
for i in $filer
do
if test -d $i # skip if directory
then
continue
fi
echo "Checking file $STARTDIR/$i"
if $ODUMPPATH/odump -symbols $i|grep Entry|grep Univ | grep -i $3
then
echo "Symbol $3 found in file $STARTDIR/$i"
if test -L $i
then
echo "NOTE!!! $i is a link:"
LINKTEXT=$(ls -l $i) # to avoid tab-expansion
echo $LINKTEXT
fi
echo ""
fi
done


Olav


H.Merijn Brand (procura
Honored Contributor

Re: linking problem

l1:/usr/lib 103 > grep eprintf defs.nm
t 0x000BB5B8 ./libdce.sl:rpc__svc_eprintf
l1:/usr/lib 104 >

the defs.nm, which lists the symbols that are *defined* in any module, is created - alongside libs.nm, which contains a list of *all* symbols, and libs.ar, which contains an object listing - by the attached perl script. I should run it after every system upgrade, either patches or applications, but I tend to forget, so maybe the umoddi3 is int there already.
Enjoy, Have FUN! H.Merijn