using static library
Net Llama
beemer9
Mon May 17 11:28:55 PDT 2004
--- "M.W.Chang" <mwchang at netvigator.com> wrote:
> Is he asking too much from gcc?
>
> -- cross-posted from another newsroup ---
>
> I tried to use dlopen() in a static compiled program, but failed.
> (i want to compile it staticly for portability reason)
> So I tried to compile the libc in in a manual way:
>
> $ gcc main.c
> $ cat main.c
> #include <stdio.h>
>
> int main () {
> printf("okay\n");
> }
> $ gcc main.c
> $ ./a.out
> okay
> $ ldd a.out
> libc.so.6 => /lib/libc.so.6 (0x40019000)
> /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
> $ gcc -nostdlib main.c /usr/lib/libc.a
> /usr/lib/gcc-lib/i386-linux/2.95.4/libgcc.a
> /usr/bin/ld: warning: cannot find entry symbol _start; defaulting to
> 08048080
> $ ./a.out
> okay
> Segmentation fault <---- Why segfault here?
> $ ldd a.out
> not a dynamic executable
Actually, it looks like he doesn't know what he's doing. If he wants to
compile something statically, then why is he running ldd against it?
=====
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lonni J. Friedman netllama at linux-sxs.org
Linux Step-by-step help: http://netllama.ipfox.com
.
__________________________________________________
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/
More information about the Linux-users
mailing list