public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* mudflapth -  undefined symbol: main
@ 2008-03-13 22:11 John Carter
  2008-03-17 22:55 ` SOLVED! " John Carter
  0 siblings, 1 reply; 2+ messages in thread
From: John Carter @ 2008-03-13 22:11 UTC (permalink / raw)
  To: gcc-help

I'm trying to get mudflap going on i686-pc-linux-gnu-gcc (GCC) 4.2.3

I use -fmudflapth on compiling and linking and -lmudflapth on linking.


When I run it I get....
LD_LIBRARY_PATH=/opt/i686-pc-linux-gnu/lib:/usr/lib:/lib ~/ffoo
/home/johnc/ffoo: symbol lookup error: /opt/i686-pc-linux-gnu/lib/libmudflapth.so.0: undefined symbol: main

If I try to statically link it ( -static) I get many warnings...

/opt/i686-pc-linux-gnu/lib/libmudflapth.a(mf-hooks2.o): In function `__mfwrap_getgrgid':
mf-hooks2.c:(.text.__mfwrap_getgrgid+0xc): warning: Using 'getgrgid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/opt/i686-pc-linux-gnu/lib/libmudflapth.a(mf-hooks2.o): In function `__mfwrap_getgrnam':
mf-hooks2.c:(.text.__mfwrap_getgrnam+0x71): warning: Using 'getgrnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/opt/i686-pc-linux-gnu/lib/libmudflapth.a(mf-hooks2.o): In function `__mfwrap_getpwnam':
mf-hooks2.c:(.text.__mfwrap_getpwnam+0x71): warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/opt/i686-pc-linux-gnu/lib/libmudflapth.a(mf-hooks2.o): In function `__mfwrap_getpwuid':
mf-hooks2.c:(.text.__mfwrap_getpwuid+0xc): warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/opt/i686-pc-linux-gnu/lib/libmudflapth.a(mf-hooks2.o): In function `__mfwrap_gethostbyname':
mf-hooks2.c:(.text.__mfwrap_gethostbyname+0x60): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/opt/i686-pc-linux-gnu/lib/libmudflapth.a(mf-hooks2.o): In function `__mfwrap_getprotobynumber':
mf-hooks2.c:(.text.__mfwrap_getprotobynumber+0xc): warning: Using 'getprotobynumber' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/opt/i686-pc-linux-gnu/lib/libmudflapth.a(mf-hooks2.o): In function `__mfwrap_getprotoent':
mf-hooks2.c:(.text.__mfwrap_getprotoent+0x5): warning: Using 'getprotoent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/opt/i686-pc-linux-gnu/lib/libmudflapth.a(mf-hooks2.o): In function `__mfwrap_getprotobyname':
mf-hooks2.c:(.text.__mfwrap_getprotobyname+0x70): warning: Using 'getprotobyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/opt/i686-pc-linux-gnu/lib/libmudflapth.a(mf-hooks2.o): In function `__mfwrap_getservbyname':
mf-hooks2.c:(.text.__mfwrap_getservbyname+0xeb): warning: Using 'getservbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/opt/i686-pc-linux-gnu/lib/libmudflapth.a(mf-hooks2.o): In function `__mfwrap_getservbyport':
mf-hooks2.c:(.text.__mfwrap_getservbyport+0x79): warning: Using 'getservbyport' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/opt/i686-pc-linux-gnu/lib/libmudflapth.a(mf-hooks2.o): In function `__mfwrap_getservent':
mf-hooks2.c:(.text.__mfwrap_getservent+0x5): warning: Using 'getservent' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking


but it seems to run. Any suggestions on how to get rid of the warnings
or get the dynamically linked version running?

The .o and the statically link executable it has a "main".


Looking in the dynamically link executable with nm --extern I see main is indeed missing.






John Carter                             Phone : (64)(3) 358 6639
Tait Electronics                        Fax   : (64)(3) 359 4632
PO Box 1645 Christchurch                Email : john.carter@tait.co.nz
New Zealand

^ permalink raw reply	[flat|nested] 2+ messages in thread

* SOLVED! Re: mudflapth -  undefined symbol: main
  2008-03-13 22:11 mudflapth - undefined symbol: main John Carter
@ 2008-03-17 22:55 ` John Carter
  0 siblings, 0 replies; 2+ messages in thread
From: John Carter @ 2008-03-17 22:55 UTC (permalink / raw)
  To: gcc-help

On Fri, 14 Mar 2008, John Carter wrote:

> I'm trying to get mudflap going on i686-pc-linux-gnu-gcc (GCC) 4.2.3
>
> I use -fmudflapth on compiling and linking and -lmudflapth on linking.
>
>
> When I run it I get....
> LD_LIBRARY_PATH=/opt/i686-pc-linux-gnu/lib:/usr/lib:/lib ~/ffoo
> /home/johnc/ffoo: symbol lookup error: 
> /opt/i686-pc-linux-gnu/lib/libmudflapth.so.0: undefined symbol: main

Ha! Solved!

Since our primary target is an embedded system (where we're trying
hard to save flash/ram space) I had '-Wl,--gc-sections'

If I removed that, the problem went away....

To be replaced by reentrancy error.....

But that was solved by LD_PRELOAD=/path/to/libmudflapth.so.0

John Carter                             Phone : (64)(3) 358 6639
Tait Electronics                        Fax   : (64)(3) 359 4632
PO Box 1645 Christchurch                Email : john.carter@tait.co.nz
New Zealand

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-03-17 22:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-13 22:11 mudflapth - undefined symbol: main John Carter
2008-03-17 22:55 ` SOLVED! " John Carter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).