Linux

即使更新了 ld.so.conf 也找不到共享庫

  • October 2, 2013
$ sudo ldconfig -v|grep libOpenNI
355: libOpenNI2.so -> libOpenNI2.so

但是當我執行程序時,我得到了

./SimpleRead: error while loading shared libraries: libOpenNI2.so: cannot open shared object file: No such file or directory

奇怪的?!!

如果您執行該命令ldd ./SimpleRead,您可以看到有關您的執行檔嘗試使用哪些動態庫的更多詳細資訊。此外,您可以查看它在系統上的哪個位置查找這些動態庫(.so 文件)。

例子

$ ldd /bin/ls
   linux-vdso.so.1 =>  (0x00007ffff6dff000)
   libselinux.so.1 => /lib64/libselinux.so.1 (0x00000034e8e00000)
   librt.so.1 => /lib64/librt.so.1 (0x00000034e8a00000)
   libcap.so.2 => /lib64/libcap.so.2 (0x0000003d6fe00000)
   libacl.so.1 => /lib64/libacl.so.1 (0x00000034fae00000)
   libc.so.6 => /lib64/libc.so.6 (0x00000034e7200000)
   libdl.so.2 => /lib64/libdl.so.2 (0x00000034e7a00000)
   /lib64/ld-linux-x86-64.so.2 (0x00000034e6e00000)
   libpthread.so.0 => /lib64/libpthread.so.0 (0x00000034e7e00000)
   libattr.so.1 => /lib64/libattr.so.1 (0x00000034f7600000)

參考

引用自:https://unix.stackexchange.com/questions/93313