link errors building profiled Oracle OCI exe on Solaris

link errors building profiled Oracle OCI exe on Solaris

Post by Rahul Soo » Mon, 22 Feb 1999 04:00:00



Using OCI to communicate with Oracle 7.3.4, we want to generate some
program statistics. I tried building the code with
Sun cc compiler's "-pg" option, but got the following link error in an
Oracle TNS library which apparently causes some name
conflicts with Solaris profiling C library:

$make dbtest
ld: fatal: symbol `waitpid' is multiply defined:
        (file /u01/app/oracle/product/7.3.4.0.1/lib/libsqlnet.a(sntp.o)
and file /usr/lib/libp/libc.a(thr_stub.o));
ld: fatal: symbol `wait' is multiply defined:
        (file /u01/app/oracle/product/7.3.4.0.1/lib/libsqlnet.a(sntp.o)
and file /usr/lib/libp/libc.a(thr_stub.o));
ld: fatal: File processing errors.  No output written to dbtest
*** Error code 1
make: Fatal error: Command failed for target `dbtest'

Here's the output from compiler dry runs for the link step. The
executable is called dbtest.

When linking without the profiling option, "-pg",  the executable links
correctly, as follows:

/usr/ccs/bin/ld -L/u01/app/oracle/product/7.3.4.0.1/rdbms/lib
-L/u01/app/oracle/product/7.3.4.0.1/lib
-R/app/SUNWspro/lib:/opt/SUNWspro/lib -o dbtest
/app/SUNWspro/SC4.2/lib/crti.o /app/SUNWspro/SC4.2/lib/crt1.o
/app/SUNWspro/SC4.2/lib/values-xa.o -Y
P,/app/SUNWspro/lib:/app/SUNWspro/SC4.2/lib:/app/SUNWspro/lib/rw7:/app/SUNWspro/SC4.2/lib/rw7:/usr/ccs/lib:/usr/lib

dbtest.o -lsqlnet -lncr -lsqlnet -lclient -lcommon -lgeneric -lsqlnet
-lncr -lsqlnet -lclient -lcommon -lgeneric -lepc
-lnlsrtl3 -lc3v6 -lcore3 -lnlsrtl3 -lcore3 -lnlsrtl3 -lsocket -lnsl -lm
-ldl -lposix4 -ldce -lthread -lm -lcore3 -lsocket
-lnsl -lm -ldl -lposix4 -ldce -lthread -lm -lC -lw -lthread -lcx -lc
/app/SUNWspro/SC4.2/lib/crtn.o >&/tmp/ld.10709.0.err

But when compiling and linking  with "-pg" I get the "symbol multiply
defined" errors mentioned above. The dry run for link
stage is:

/usr/ccs/bin/ld -L/u01/app/oracle/product/7.3.4.0.1/rdbms/lib
-L/u01/app/oracle/product/7.3.4.0.1/lib
-R/app/SUNWspro/lib:/opt/SUNWspro/lib -o dbtest
/app/SUNWspro/SC4.2/lib/crti.o /app/SUNWspro/SC4.2/lib/gcrt1.o
/app/SUNWspro/SC4.2/lib/values-xa.o -Y
P,/app/SUNWspro/SC4.2/lib/libp:/app/SUNWspro/SC4.2/lib/libp/rw7:/usr/ccs/lib/libp:/usr/lib/libp:/app/SUNWspro/lib:/app/SUNWspro/SC4.2/lib:/app/SUNWspro/lib/rw7:/app/SUNWspro/SC4.2/lib/rw7:/usr/ccs/lib:/usr/lib

dbtest.o -lsqlnet -lncr -lsqlnet -lclient -lcommon -lgeneric -lsqlnet
-lncr -lsqlnet -lclient -lcommon -lgeneric -lepc
-lnlsrtl3 -lc3v6 -lcore3 -lnlsrtl3 -lcore3 -lnlsrtl3 -lsocket -lnsl -lm
-ldl -lposix4 -ldce -lthread -lm -lcore3 -lsocket
-lnsl -lm -ldl -l posix4 -ldce -lthread -ldl -lm -lC -lw -lthread -lcx
-lc /app/SUNWspro/SC4.2/lib/crtn.o

Quote:>&/tmp/ld.10726.0.err

The difference in linking with and without "-pg" is that, in the first
case ld links in the C runtime object
/app/SUNWspro/SC4.2/lib/crt1.o and uses the path to shared libraries
-Y
P,/app/SUNWspro/lib:/app/SUNWspro/SC4.2/lib:/app/SUNWspro/lib/rw7:/app/SUNWspro/SC4.2/lib/rw7:usr/ccs/lib:/usr/lib

whereas in the second,  it  links in the C runtime object
/app/SUNWspro/SC4.2/lib/gcrt1.o and uses the path to shared
libraries
-Y
P,/app/SUNWspro/SC4.2/lib/libp:/app/SUNWspro/SC4.2/lib/libp/rw7:/usr/ccs/lib/libp:/usr/lib/libp

Since the Oracle library, libsqlnet.a,  is the same in both cases,
something about the C library causes the link to fail when
using the profiling library  /usr/lib/libp/libc.a
This happens on Solaris 2.5.1/SPARC

If anyone has built OCI programs on Solaris with profiling enabled, pls
let me know how to go about this.

R. Sood

 
 
 

link errors building profiled Oracle OCI exe on Solaris

Post by JTPage » Tue, 23 Feb 1999 04:00:00


I've got a make file for you to try.
Problem is My server is down. It is a make file from AIX, but it should be fine
for you. As soon as it's up, I will email the makes to you.
JAMIE
SR/DEV/UNIX