gcc linker error - hidden symbol `stat' in /usr/lib/libc_nonshared.a(stat.oS)
Am getting this linker error from gcc on linux:
hidden symbol `stat' in /usr/lib/libc_nonshared.a(stat.oS) is referenced by DSO
The complaint is from my library, all objects rebuilt by v4.3.2 gcc and g++. And yes some of the routines do call stat()
apologies if this is a compiler/linker option that i've missed but am able to link on opensolaris and other platforms just fine, so wondered if is a linux-gcc issue that might already be answered here?
i've tried a few options building my DSO... including -shared but it seems like stat() is a weak symbol that does not resolve?
here's some details if that helps...
ld --version == 2.19.1
/usr/lib/libc.so is actually this linker script:
/* 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 AS_NEEDED ( /lib/ld-linux.so.2 ) )
/lib/libc.so.6 is symbolic link to /lib/libc-2.9.so
readelf -s /lib/libc-2.9.so doesn't show stat() exported
/usr/lib/libc_nonshared.a (also in /usr/lib/libc.a) defines stat as a weak symbol:
00000000 W stat