I need to run my program in another linux distro which does not have the mudflap library installed and has a different glibc version. I have tried to compile my program with -static but it is not possible:
warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
So, I'm trying -nostdlib and attaching the libs manually but get these errors:
myuser@linux:~/Desktop$ gcc -nostdlib -Wl,-dynamic-linker,/home/myuser/Desktop/ld-linux-x86-64.so.2,-rpath,/home/myuser/Desktop /home/myuser/Desktop/libc.so.6 -fmudflap /home/myuser/Desktop/libmudflap.so.0 /home/myuser/Desktop/libdl.so.2 simple.c myuser@linux:~/Desktop$ ./a.out mf: dlsym("mmap") = NULL Aborted (core dumped) myuser@linux:~/Desktop$ ldd a.out linux-vdso.so.1 => (0x00007fff2bad2000) libc.so.6 => /home/myuser/Desktop/libc.so.6 (0x00007fddfd521000) libmudflap.so.0 => /home/myuser/Desktop/libmudflap.so.0 (0x00007fddfd175000) libdl.so.2 => /home/myuser/Desktop/libdl.so.2 (0x00007fddfcf70000) /home/myuser/Desktop/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 (0x00007fddfd884000) myuser@linux:~/Desktop$
- Which ld is really being used ? The one in my Desktop or the one in /lib64 ?
- What other flags have to be included to make it compile correctly ?