I'm working on porting a set of libraries that currently run on several other
un*x systems to Linux. Our makefiles use ld in order to do the final linking
of objects into the shared libraries. Essentially, the ld command we use for
the final link is this:
/usr/bin/ld -shared -o libmylib.so obj1.o obj2.o obj3.o -ldl
Unfortunately, when we try to run an application linked against this libarary,
we get the following error:
testapp: error while loading shared libraries: libmylib.so: undefined symbol:
fstat
This is on a Red Hat 7.2 system using the "stock" compiler, linker, etc.
Now I know that this can be solved by adding -lc to the ld command to link
against libc, but I was wondering if there is some other ld flag I could use so
that this wouldn't be necessary.
Also, I have another question. Earlier we had some an experimental port of
this library to Red Hat 6.x (I forget the exact version, I think it was 6.2,
but I'm not sure), and as far as I know (I didn't do the port) everything
worked without ld explicitly linking with libc on its command line. Did
something change in the linker between these two versions of Red Hat or
something?
Thanks!
--
-------------------- http://www.techhouse.org/lou ----------------------
"Dragonmaster Lou" | "Searching for a distant star, heading off to
lou at techhouse org | Iscandar, leaving all we love behind, who knows
Tech House Alum | what dangers we'll find..."
-----------------------------------------------------------------------