Re: Woody: Relocation error when calling stat/fstat from shared library
On Tue, Mar 05, 2002 at 02:20:05PM +0100, Leif Thuresson wrote:
> I have come across a strange bug in woody when createing a shared
> library.
> If I make a shared library and calls the glibc functions stat() or
> fstat() from
> within my shared library I get a relocation error when I run a program
> using my library.
> If I don't call stat/fstat but only other glibc functions like open,
> close etc.
> the program runs fine
> When I first noticed this problem I only got the error when I linked the
> shared
> library with a version-script to only export the functions used by my
> program.
> I then upgraded binutils from
> binutils_2.11.92.0.12.3-3_i386.deb
> to
> binutils_2.11.92.0.12.3-6_i386.deb
> and now I get the error both with and without using the version-script !.
> I use gcc version 2.95.4 and glibc 2.2.4.
>
> I also tested and recompiled the shared library and program on
> a readhat 6.2 system at my work and there every thing ran without errors.
I bet you are using ld to link the shared library, instead of gcc.
That's bad, mainly because you miss the -lc and -lgcc links that gcc
automatically adds in.
Word to the wise, always use LD=gcc where gcc is available. Will make
you life a lot easier.
--
.----------=======-=-======-=========-----------=====------------=-=-----.
/ Ben Collins -- Debian GNU/Linux -- WatchGuard.com \
` bcollins@debian.org -- Ben.Collins@watchguard.com '
`---=========------=======-------------=-=-----=-===-======-------=--=---'
Reply to: