如何符号链接共享对象文件(lib)

时间:2013-02-19 20:10:14

标签: c shared-libraries

如何对作为共享库加载的lib文件进行符号链接?

root@root:/usr/lib# ls -l /usr/lib/ | grep libpcap
-rw-r--r--  1 root root       351636 2010-01-04 20:15 libpcap.a
lrwxrwxrwx  1 root root           14 2011-08-18 01:56 libpcap.so -> libpcap.so.0.8
lrwxrwxrwx  1 root root           16 2011-08-18 01:56 libpcap.so.0.8 ->  libpcap.so.1.0.0
lrwxrwxrwx  1 root root           25 2013-02-19 10:01 libpcap.so.1 -> /usr/lib/libpcap.so.1.0.0
-rw-r--r--  1 root root       204128 2010-01-04 20:15 libpcap.so.1.0.0
root@root:/usr/lib# start-wfw 
checking wlan0
return 1
root@root:/usr/lib# /tmp/wfw: error while loading shared libraries: libpcap.so.1: cannot open shared object file: No such file or directory

root@root:/usr/lib# stop-wfw 
Stopping ()
wfw: no process found

os:backtrack 5 r1,64 | arch:x86_64

最初,echo LD_LIBRARY_PATH,返回一个空行。

创建符号链接后,我运行了ldconfig,并重试了我的可执行文件,但没有用。

如果我将LD_LIBRARY_PATH设置为/ usr / lib,则会出现ELF错误。

提前致谢。

/ edit0 @蒂格兰,@ M01:

/usr/bin/wfw-wrapper: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.27, stripped

/ edit1 @tigran:

root@root:~# ldd -v /usr/lib/libpcap.so.1.0.0
        linux-vdso.so.1 =>  (0x00007fffed5e3000)
        libc.so.6 => /lib/libc.so.6 (0x00007f64ebf3c000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f64ec510000)

        Version information:
        /usr/lib/libpcap.so.1.0.0:
                libc.so.6 (GLIBC_2.4) => /lib/libc.so.6
                libc.so.6 (GLIBC_2.3) => /lib/libc.so.6
                libc.so.6 (GLIBC_2.7) => /lib/libc.so.6
                libc.so.6 (GLIBC_2.3.4) => /lib/libc.so.6
                libc.so.6 (GLIBC_2.2.5) => /lib/libc.so.6
        /lib/libc.so.6:
                ld-linux-x86-64.so.2 (GLIBC_PRIVATE) => /lib64/ld-linux-x86-64.so.2
                ld-linux-x86-64.so.2 (GLIBC_2.3) => /lib64/ld-linux-x86-64.so.2

/ edit2

root@root:/usr/bin# file -L /usr/lib/libpcap.so.1
/usr/lib/libpcap.so.1: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, stripped

0 个答案:

没有答案