/cca中libopencv版本不一致问题

ldd libadaptor.so发现libopencv_core.so.3.3未指向本地库, 需重新编译

vim CMakeLists.txt
mkdir build
cd build/
cmake ..
make

此时再次ldd libadaptor.so发现opencv已指向本地库, 但本地为最新版本opencv3.4
运行pycharm发现仍报错3.3不存在
ls -l libadaptor.sobuild/下已经为最新的libadaptor.so, 但'ls -l ../libadaptor.so`发现外面的还是旧的
make install即可解决

使用cca/lib/下libopencv_core.so.3.3方法

在cca/lib/下输入ldd libadaptor.so
显示找不到libopencv_core.so.3.3

linux-vdso.so.1 =>  (0x00007ffc2548e000)
libopencv_core.so.3.3 => not found
libopencv_imgproc.so.3.3 => not found
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f41c037a000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f41c0164000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f41bfd9a000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f41bfa91000)
/lib64/ld-linux-x86-64.so.2 (0x00007f41c091b000)

设置LD_LIBRARY_PATH
export LD_LIBRARY_PATH=~/PycharmProjects/pixellink/cca/lib/:$LD_LIBRARY_PATH
之后再次输入ldd libadaptor.so

linux-vdso.so.1 =>  (0x00007fffc7b01000)
libopencv_core.so.3.3 => /home/renduo/PycharmProjects/pixellink/cca/lib/libopencv_core.so.3.3 (0x00007f8c72621000)
libopencv_imgproc.so.3.3 => /home/renduo/PycharmProjects/pixellink/cca/lib/libopencv_imgproc.so.3.3 (0x00007f8c6f8f0000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f8c6f56e000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f8c6f358000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8c6ef8e000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f8c6ed8a000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f8c6eb6d000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f8c6e965000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f8c6e74b000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8c6e442000)
/lib64/ld-linux-x86-64.so.2 (0x00007f8c73742000)

但这只是存在于terminal窗口, 还需修改~/.bashrc中的环境变量

export LD_LIBRARY_PATH=/home/renduo/PycharmProjects/pixellink/cca/lib{$LD_LIBRARY_PATH:+:{$LD_LIBRARY_PATH}}

查看环境变量
echo $LD_LIBRARY_PATH

/home/renduo/PycharmProjects/pixellink/cca/lib/:/usr/local/cuda/lib64

也可只在pycharm中run-edit configuration-environment varables中添加LD_LIBRARY_PATH=/home/renduo/PycharmProjects/pixellink/cca/lib:$LD_LIBRARY_PATH
或只在/etc/ld.so.conf.d/opencv.conf中添加/home/renduo/PycharmProjects/pixellink/cca/lib

你可能感兴趣的:(/cca中libopencv版本不一致问题)