On Wed, Oct 12, 2005 at 01:56:39PM -0500, Nitesh Soni (NC/TNT) wrote: > Now I dont understand one basic thing: > > Since both static and shared library versions of libY have this > symbol as "U" when I link application X with static version it works > but not with shared. Also, point to be noted is X is not using this > symbol at all. How does shared and static libraries treat the > symbols which are undefined.?
When you link against a static library, only those symbols required by X are linked in. > Thanks > > -----Original Message----- > From: Albert Chin [mailto:[EMAIL PROTECTED] > Sent: Wednesday, October 12, 2005 2:19 PM > To: Nitesh Soni (NC/TNT) > Cc: 'libtool@gnu.org' > Subject: Re: problem linking with shared library > > > On Wed, Oct 12, 2005 at 01:03:12PM -0500, Nitesh Soni (NC/TNT) wrote: > > The error linker is giving is: ... libY.so: undefined reference to > > 'Z' > > > > Also, this symbol is not used anywhere in any source code required > > to build application X ( i mean if X depends on x.c y.c z.c and > > library libY .. none of the sources x.c y.c and z.c use this symbol) > > That's ok. libY might be dependent on another library where Z is > defined. > > > I am using gcc version 3.3.1 ( MontaVista ) building for x86. > > Odd that static linking works. You can extract the object files from > libY.a to determine which one has Z undefined. As you have the source > to libY, you can find out why the symbol is undefined. > > > -----Original Message----- > > From: Albert Chin [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, October 12, 2005 1:25 PM > > To: Nitesh Soni (NC/TNT) > > Cc: libtool@gnu.org > > Subject: Re: problem linking with shared library > > > > On Wed, Oct 12, 2005 at 11:22:42AM -0500, Nitesh Soni (NC/TNT) wrote: > > > I am trying to build an executable "X" which links with libY. > > > > > > I am using libtool to build this library libY; so I have a static > > > version libY.a and libY.so > > > > > > When I link the static version libY.a, i am able to build the > > > application X But when I link against the shared version libY.so I > > > am not able to build the application; it fails with some undefined > > > reference to (lets say) Z > > > > > > Now I did "nm libY.a" and "nm libY.so" > > > > > > Both these versions have symbol Z as "U" > > > > Is symbol Z defined in executable X? > > > > What specific error is the linker giving? > > > > What platform? > > > > -- > > albert chin ([EMAIL PROTECTED]) > > -- > albert chin ([EMAIL PROTECTED]) > > > _______________________________________________ > http://lists.gnu.org/mailman/listinfo/libtool > > -- albert chin ([EMAIL PROTECTED]) _______________________________________________ http://lists.gnu.org/mailman/listinfo/libtool