gcc -- linking static and shared libraries

From: Ashish Nigam (ashishn@ntechra.com)
Date: Sun Sep 08 2002 - 23:32:44 EDT


Hi,
I have written a small application using libpcap.
libpcap has libpcap.a library file.
My problem is to statically link "libpcap.a" file and also dynamically link
other .so files to create my own .so file.
I use gcc to create .so file.
If I copy "libpcap.a" file in /usr/lib try to generate .so file of my own, I
am successfully able to create one...

I give these parameters to gcc

/opt/sfw/bin/gcc -I/usr/local/jdk/include -I/usr/local/jdk/include/solaris
-I/opt/libpcap-0.4 -fPIC -s
hared -fno-gnu-linker -lresolv -lsocket -lnsl -lpcap -o libntechping.so

My problem starts when I use this .so file
It gives me this error when I try to execute my program..

ld.so.1: /usr/bin/../java/bin/../jre/bin/../bin/sparc/native_threads/java:
fatal: relocation error: file
/opt/AssetRadarClient/sharedlib/singleos/libntechping.so: symbol
pcap_lookupdev: referenced symbol not found

It seems that libpcap has not been statically linked..... so what should I
do ....
what parameters should I give to gcc ....

Thanks,
ashish
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:24:54 EDT