$ 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
奇怪的?!!
答案1
如果运行该命令,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)