我需要在另一個沒有安裝mudflap庫並具有不同glibc版本的linux發行版中運行我的程序。我試圖編譯我的程序用-static,但它是不可能的:gcc -nostdlib和mudflap
warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
所以,我想-nostdlib並手動安裝該庫,但得到這些錯誤:
[email protected]:~/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 [email protected]:~/Desktop$ ./a.out mf: dlsym("mmap") = NULL Aborted (core dumped) [email protected]:~/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) [email protected]:~/Desktop$
- 哪個ld真的被使用?在我的桌面或在/ lib64的?
- 必須包含哪些其他標誌才能正確編譯?
在您正在部署到其他計算機的程序中使用mudflap是否有原因?這是一個調試工具... – 2011-04-25 13:06:13