using static library
M.W.Chang
mwchang
Mon May 17 11:28:54 PDT 2004
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
More information about the Linux-users
mailing list