Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 09-17-2009, 12:20 PM   #1
LQ Newbie
Registered: Jul 2009
Location: Austin, Texas
Distribution: suse
Posts: 14

Rep: Reputation: 1
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/ 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/ /usr/lib/libc_nonshared.a AS_NEEDED ( /lib/ ) )

/lib/ is symbolic link to /lib/

readelf -s /lib/ 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
Old 09-17-2009, 12:33 PM   #2
LQ Newbie
Registered: Jul 2009
Location: Austin, Texas
Distribution: suse
Posts: 14

Original Poster
Rep: Reputation: 1
well clearly it was my libraries - not checked what gcc does differently - but letting gcc build the libraries cleaned that up...

ar x ../libXXXX.a
gcc --shared -o ../ *.o

no longer get the complaint linking with my -lXXXX


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
symbol lookup error: /usr/lib/ undefined symbol: av_crc04C11DB7 priceey Linux - Software 0 05-06-2009 08:14 AM
?cause of error? /usr/include/bits/stat.h field 'st_atim' has incomplete type maxreason Programming 2 08-17-2008 01:48 AM
symbol lookup error: /usr/lib/ undefined symbol:... IamI Slackware 17 02-29-2008 11:10 AM
./firefox-bin: symbol lookup error: /usr/lib/ undefined symbol: g_s cb8100 Slackware 3 10-05-2006 10:55 AM
Starting httpd: /usr/sbin/httpd: symbol lookup error: /usr/local/lib/ bijuhpd Linux - Newbie 1 10-30-2005 05:07 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:11 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration