ldd无法找到图书馆

时间:2017-04-20 09:58:50

标签: c++ opencv dll shared-libraries

我已阅读thisthisthis

我已在服务路径/home/luca/ParallelOpenCV/install_icpc/lib中安装了OpenCV,其中有libopencv_core.so

luca@jarvis:~$ ldd /home/luca/ParallelOpenCV/install_icpc/lib/libopencv_core.so
    linux-vdso.so.1 =>  (0x00007ffccb389000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f46af719000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f46af410000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f46af1f2000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f46aefea000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f46aedd0000)
    libimf.so => /opt/intel/compilers_and_libraries_2017.1.132/linux/compiler/lib/intel64/libimf.so (0x00007f46ae8e3000)
    libsvml.so => /opt/intel/compilers_and_libraries_2017.1.132/linux/compiler/lib/intel64/libsvml.so (0x00007f46ad9d8000)
    libirng.so => /opt/intel/compilers_and_libraries_2017.1.132/linux/compiler/lib/intel64/libirng.so (0x00007f46ad663000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f46ad2e0000)
    libiomp5.so => /opt/intel/compilers_and_libraries_2017.1.132/linux/compiler/lib/intel64/libiomp5.so (0x00007f46acf3d000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f46acd27000)
    libintlc.so.5 => /opt/intel/compilers_and_libraries_2017.1.132/linux/compiler/lib/intel64/libintlc.so.5 (0x00007f46acabc000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f46ac6f3000)
    /lib64/ld-linux-x86-64.so.2 (0x000055f67574e000)

我添加了LD_LIBRARY_PATH的路径并执行了ldconfig,但是:

luca@jarvis:~$ ldd libopencv_core.so
ldd: ./libopencv_core.so: No such file or directory

我错过了什么?

1 个答案:

答案 0 :(得分:1)

来自man ldd: -

NAME

       ldd - print shared object dependencies
SYNOPSIS         top

       ldd [option]... file...
DESCRIPTION

       ldd prints the shared objects (shared libraries) required by each
       program or shared object specified on the command line.  An example
       of its use and output is the following:

       $ ldd /bin/ls
               linux-vdso.so.1 (0x00007ffcc3563000)
               libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f87e5459000)
               libcap.so.2 => /lib64/libcap.so.2 (0x00007f87e5254000)
               libc.so.6 => /lib64/libc.so.6 (0x00007f87e4e92000)
               libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f87e4c22000)
               libdl.so.2 => /lib64/libdl.so.2 (0x00007f87e4a1e000)
               /lib64/ld-linux-x86-64.so.2 (0x00005574bf12e000)
               libattr.so.1 => /lib64/libattr.so.1 (0x00007f87e4817000)
               libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f87e45fa000)

命令的输出:

luca@jarvis:~$ ldd libopencv_core.so
ldd: ./libopencv_core.so: No such file or directory

表示程序或共享对象应该在上指定 隐含目录中不存在命令行 = ./ = /home/luca。 我们知道它存在于/home/luca/ParallelOpenCV/install_icpc/lib

如果您运行ldd 文件,其中 file ,在shell扩展后,是路径名 现有文件,然后ldd将显示动态依赖项 该文件的内容,由动态链接器发现,并且通常依赖于它 当前ldconfig配置及其对操作员的通常考虑 LD_LIBRARY_PATH环境设置。它不会搜索您的系统 对于可能是不存在的文件的备用候选文件 并显示这些候选人的动态依赖关系。