Problem
Attempting to build my third party application on OpenServer 5.0.7, with the development system is failing with undefined symbols _fini and _init as follows:
undefined first referenced
symbol in file
_fini /my/build/dir/a.out
_init /my/build/dir/a.out
i386ld fatal: Symbol referencing errors. No output written
to your.application Cause
There have been many core changes in OpenServer 5.0.7 and
these two symbols have been moved to other locations.
Normally this is from a third party makefile or script
referencing idld directly. This is incorrect for cc
should be the program called. Calling idld directly does
ensure cross-platform compatibility and even release
compatibility. Solution
The best solution for this problem is to have your third
party application vendor rewrite their compilation/build
script to properly call cc when linking their object files
together. This is standard practice as the cc for the
specific release will know about the core symbols that
must be present for the linking to perform properly.If your third party application vendor is unwilling or unable to properly rewrite their build script, there is a workaround for this, as follows:
Move the /bin/idld binary out of the way, "mv /bin/idld /bin/idld.orig", and then create a script called /bin/idld, with the following contents:
=============================CUT HERE============================= #!/bin/sh
#
# Add crti.o to link lines which newly require it;
# move crtn.o to end of link line where it belongs
#
had_crt1=0
had_crti=0
had_crtn=0
for arg; do
case `basename $arg` in
crt1.o) had_crt1=1; crt_path=`dirname $arg`;;
crti.o) had_crti=1;;
crtn.o) had_crtn=1; crtn_path=$arg; continue;;
esac
args="$args $arg"
done
if [ $had_crt1$had_crti = 10 -a -f $crt_path/crti.o ];
then
args="$args $crt_path/crti.o"
fi
if [ $had_crt1$had_crtn = 11 -a -f $crt_path/crtn.o ];
then
args="$args $crt_path/crtn.o"
elif [ $had_crtn = 1 ]; then
args="$args $crtn_path"
fi
exec /bin/idld.orig $args
=============================END HERE=========================Then make this script executable, "chmod +x /bin/idld".
Now attempt to rebuild your application and the unresolved symbols error should not be present.
See also
TA#111092 - "Trying to compile Oracle 7.3.4 on OpenServer 5.0.5 fails with "/usr/ccs/lib/crt1.o fatal: cannot open ELF for input". "