[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: stat() problem in shared libraries (yes /usr/lib/libc.so is correct)
From: |
Michael F. Brown |
Subject: |
Re: stat() problem in shared libraries (yes /usr/lib/libc.so is correct) |
Date: |
Thu, 20 Sep 2001 13:57:51 -0400 (EDT) |
Hi,
Thank you very much for your insight.
changing the ld line to:
gcc -shared -o /lib/libmy_stat.so my_stat.o
fixes the issue.
-Michael F. Brown, Sym API - EMC Corp.
email: address@hidden
"In theory, there is no difference between theory and practice,
but in practice, there is." - Jan L.A. van de Snepscheut
On Thu, 20 Sep 2001, Andreas Jaeger wrote:
> Date: Thu, 20 Sep 2001 19:31:02 +0200
> From: Andreas Jaeger <address@hidden>
> To: Michael F. Brown <address@hidden>
> Cc: address@hidden
> Subject: Re: stat() problem in shared libraries (yes /usr/lib/libc.so is
> correct)
>
> "Michael F. Brown" <address@hidden> writes:
>
> > Hi,
> >
> > I've read the glibc FAQ as well as searched this lists archives for
> > an answer on this issue.
> >
> > We ship a shared object which uses stat, and on more recent versions
> > of glibc (2.2.2) when running with our library we get the error
> > message:
> >
> > "error while loading shared libraries: /usr/lib/libmy_stat.so:
> > undefined symbol: stat"
> >
> > Yes, /usr/lib/libc.so looks like:
> >
> > /* GNU ld script
> > Use the shared library, but some functions are only in
> > the static library, so try that secondarily. */
> > GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a )
> >
> > This is reproducible on various linux hosts.
> >
> > Here's a sample program and Makefile:
> >
> > ---- Makefile ----
> >
> > all: my_main
> >
> > my_main: my_main.c /lib/libmy_stat.so
> > gcc -Wall -g -o my_main my_main.c -lmy_stat
> >
> > /lib/libmy_stat.so: my_stat.o
> > ld -G -dy -o /lib/libmy_stat.so my_stat.o
>
> You should not link on Linux with just ld, use gcc for linking.
>
> Andreas
> --
> Andreas Jaeger
> SuSE Labs address@hidden
> private address@hidden
> http://www.suse.de/~aj
>