Hi
I'm trying to link with the static libc.a and a dynamic lib .so unsuccessfully.
I've already tryied the following:
Firstly I test with all dynamic:
- gcc -shared libtest.c -o libtest.so
- gcc -c main.c -o main.o
- gcc main.o -o test -L. -ltest
It's working (compile and execute)
Secondly I test what I want (dynamic lib and static libc) :
- gcc -shared libtest.c -o libtest.so
- gcc -c main.c -o main.o
- gcc main.o -o test libtest.so /usr/lib/libc.a
It's compiling, but at execution, it segfault! A strace show that it's trying to access libc.so!!!
Finally I've tried to compile a simple progam with no reference to dynamic lib
- gcc -static main.c --> compile ok, run ok
- gcc main.c /usr/lib/libc.a --> compile ok, run : segmentation fault (a strace show that it's access to libc.so)
How to do that?
Thank you