我有CUDA 6.0和OpenCV 2.4.8(用CUDA编译),我用它来学习它,然后我买了一台Jetson TK-1。 NVIDIA发布了用于Tegra K1的R21.2驱动程序包和CUDA 6.5,并且我安装了CUDA 6.5并使用CUDA样本进行了测试,它们运行正常。之后,我删除了CUDA 6.0,样品仍在运行。我已经安装了OpenCV的新版本2.4.1但我没有删除2.4.8共享库和标题。我用./build_all.sh
编译了所有C样本,所有这些样本都编译没有错误但是当我想在../samples/c
目录中运行任何样本时,例如sudo ./contours
我面对的是问题是./contours: error while loading shared libraries: libcudart.so.6.0: cannot open shared object file: No such file or directory
,但当我选中LD_LIBRARY_PATH
或PATH
或opencv.cv
文件和PKG_CONFIG_PATH
(用于右opencv.cv
路径)时无法看到任何问题。我添加了每个路径变量的echo
输出;
echo $LD_LIBRARY_PATH
:/usr/local/cuda-6.5/lib:/usr/local/cuda-6.5/lib64:/usr/local/opencv-2.4.9/lib
echo $PATH
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/CodeSourcery/arm-2013.11/bin:/opt/STLink/stlink:/opt/R-Pi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin:/opt/CodeSourcery/arm-2013.11/bin:/usr/local/cuda-6.5/bin:/usr/local/cuda/bin
echo $PKG_CONFIG_PATH
/usr/local/opencv-2.4.9/lib/pkgconfig
opencv.pc
档案
# Package Information for pkg-config
prefix=/usr/local/opencv-2.4.9
exec_prefix=${prefix}
libdir=${prefix}
includedir_old=${prefix}/include/opencv
includedir_new=${prefix}/include
Name: OpenCV
Description: Open Source Computer Vision Library
Version: 2.4.9
Libs: ${exec_prefix}/lib/libopencv_calib3d.so ${exec_prefix}/lib/libopencv_contrib.so ${exec_prefix}/lib/libopencv_core.so ${exec_prefix}/lib/libopencv_features2d.so ${exec_prefix}/lib/libopencv_flann.so ${exec_prefix}/lib/libopencv_gpu.so ${exec_prefix}/lib/libopencv_highgui.so ${exec_prefix}/lib/libopencv_imgproc.so ${exec_prefix}/lib/libopencv_legacy.so ${exec_prefix}/lib/libopencv_ml.so ${exec_prefix}/lib/libopencv_nonfree.so ${exec_prefix}/lib/libopencv_objdetect.so ${exec_prefix}/lib/libopencv_ocl.so ${exec_prefix}/lib/libopencv_photo.so ${exec_prefix}/lib/libopencv_stitching.so ${exec_prefix}/lib/libopencv_superres.so ${exec_prefix}/lib/libopencv_ts.a ${exec_prefix}/lib/libopencv_video.so ${exec_prefix}/lib/libopencv_videostab.so /usr/local/cuda/lib64/libcufft.so /usr/local/cuda/lib64/libnpps.so /usr/local/cuda/lib64/libnppi.so /usr/local/cuda/lib64/libnppc.so /usr/local/cuda/lib64/libcudart.so -ltbb /usr/lib/x86_64-linux-gnu/libXext.so /usr/lib/x86_64-linux-gnu/libX11.so /usr/lib/x86_64-linux-gnu/libICE.so /usr/lib/x86_64-linux-gnu/libSM.so /usr/lib/libGL.so /usr/lib/x86_64-linux-gnu/libGLU.so -lrt -lpthread -lm -ldl
Cflags: -I${includedir_old} -I${includedir_new}
为什么会这样?感谢。
ldd ./contours
linux-vdso.so.1 => (0x00007fff89ffe000)
libopencv_core.so.2.4 => /usr/local/opencv-2.4.9/lib/libopencv_core.so.2.4 (0x00007f621a97c000)
libopencv_highgui.so.2.4 => /usr/local/opencv-2.4.9/lib/libopencv_highgui.so.2.4 (0x00007f621a6ec000)
libopencv_imgproc.so.2.4 => /usr/local/opencv-2.4.9/lib/libopencv_imgproc.so.2.4 (0x00007f621a21b000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f6219efb000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6219b3b000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f6219924000)
libcudart.so.6.5 => /usr/local/cuda/lib64/libcudart.so.6.5 (0x00007f62196d4000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f62194b6000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f62192ae000)
libGL.so.1 => /usr/lib/libGL.so.1 (0x00007f6218f62000)
libtbb.so.2 => /usr/lib/libtbb.so.2 (0x00007f6218d34000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f6218a28000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f6218811000)
libjpeg.so.8 => /usr/lib/x86_64-linux-gnu/libjpeg.so.8 (0x00007f62185c0000)
libpng12.so.0 => /lib/x86_64-linux-gnu/libpng12.so.0 (0x00007f6218398000)
libtiff.so.4 => /usr/lib/x86_64-linux-gnu/libtiff.so.4 (0x00007f6218134000)
libjasper.so.1 => /usr/lib/x86_64-linux-gnu/libjasper.so.1 (0x00007f6217edc000)
libIlmImf.so.6 => /usr/lib/libIlmImf.so.6 (0x00007f6217c1b000)
libHalf.so.6 => /usr/lib/libHalf.so.6 (0x00007f62179d8000)
libdc1394.so.22 => /usr/lib/x86_64-linux-gnu/libdc1394.so.22 (0x00007f6217764000)
libv4l1.so.0 => /usr/lib/x86_64-linux-gnu/libv4l1.so.0 (0x00007f621755e000)
libavcodec.so.53 => /usr/lib/x86_64-linux-gnu/libavcodec.so.53 (0x00007f6216742000)
libavformat.so.53 => /usr/lib/x86_64-linux-gnu/libavformat.so.53 (0x00007f6216440000)
libavutil.so.51 => /usr/lib/x86_64-linux-gnu/libavutil.so.51 (0x00007f6216220000)
libswscale.so.2 => /usr/lib/x86_64-linux-gnu/libswscale.so.2 (0x00007f6215fda000)
libQtOpenGL.so.4 => /usr/lib/x86_64-linux-gnu/libQtOpenGL.so.4 (0x00007f6215cdb000)
libQtGui.so.4 => /usr/lib/x86_64-linux-gnu/libQtGui.so.4 (0x00007f621500d000)
libQtTest.so.4 => /usr/lib/x86_64-linux-gnu/libQtTest.so.4 (0x00007f6214de7000)
libQtCore.so.4 => /usr/lib/x86_64-linux-gnu/libQtCore.so.4 (0x00007f6214914000)
/lib64/ld-linux-x86-64.so.2 (0x00007f621ae44000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f6214710000)
libnvidia-tls.so.340.58 => /usr/lib/tls/libnvidia-tls.so.340.58 (0x00007f621450c000)
libnvidia-glcore.so.340.58 => /usr/lib/libnvidia-glcore.so.340.58 (0x00007f62118f8000)
libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f62115c3000)
libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f62113b1000)
libImath.so.6 => /usr/lib/libImath.so.6 (0x00007f62111ab000)
libIex.so.6 => /usr/lib/libIex.so.6 (0x00007f6210f8b000)
libIlmThread.so.6 => /usr/lib/libIlmThread.so.6 (0x00007f6210d84000)
libraw1394.so.11 => /usr/lib/x86_64-linux-gnu/libraw1394.so.11 (0x00007f6210b75000)
libusb-1.0.so.0 => /lib/x86_64-linux-gnu/libusb-1.0.so.0 (0x00007f6210965000)
libv4l2.so.0 => /usr/lib/x86_64-linux-gnu/libv4l2.so.0 (0x00007f6210759000)
libxvidcore.so.4 => /usr/lib/x86_64-linux-gnu/libxvidcore.so.4 (0x00007f6210422000)
libx264.so.120 => /usr/lib/x86_64-linux-gnu/libx264.so.120 (0x00007f621009b000)
libvpx.so.1 => /usr/lib/libvpx.so.1 (0x00007f620fdf6000)
libvorbisenc.so.2 => /usr/lib/x86_64-linux-gnu/libvorbisenc.so.2 (0x00007f620f927000)
libvorbis.so.0 => /usr/lib/x86_64-linux-gnu/libvorbis.so.0 (0x00007f620f6fa000)
libvo-amrwbenc.so.0 => /usr/lib/x86_64-linux-gnu/libvo-amrwbenc.so.0 (0x00007f620f4df000)
libvo-aacenc.so.0 => /usr/lib/x86_64-linux-gnu/libvo-aacenc.so.0 (0x00007f620f2c0000)
libtheoraenc.so.1 => /usr/lib/x86_64-linux-gnu/libtheoraenc.so.1 (0x00007f620f082000)
libtheoradec.so.1 => /usr/lib/x86_64-linux-gnu/libtheoradec.so.1 (0x00007f620ee67000)
libspeex.so.1 => /usr/lib/x86_64-linux-gnu/libspeex.so.1 (0x00007f620ec4e000)
libschroedinger-1.0.so.0 => /usr/lib/libschroedinger-1.0.so.0 (0x00007f620e99a000)
libopenjpeg.so.2 => /usr/lib/libopenjpeg.so.2 (0x00007f620e779000)
libmp3lame.so.0 => /usr/lib/x86_64-linux-gnu/libmp3lame.so.0 (0x00007f620e4ef000)
libgsm.so.1 => /usr/lib/libgsm.so.1 (0x00007f620e2e0000)
libdirac_encoder.so.0 => /usr/lib/libdirac_encoder.so.0 (0x00007f620e05a000)
libva.so.1 => /usr/lib/x86_64-linux-gnu/libva.so.1 (0x00007f620de44000)
libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.so.1.0 (0x00007f620dc33000)
libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f620d997000)
libXrender.so.1 => /usr/lib/x86_64-linux-gnu/libXrender.so.1 (0x00007f620d78c000)
libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007f620d556000)
libaudio.so.2 => /usr/lib/x86_64-linux-gnu/libaudio.so.2 (0x00007f620d33e000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f620d049000)
libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007f620cdf9000)
libSM.so.6 => /usr/lib/x86_64-linux-gnu/libSM.so.6 (0x00007f620cbf1000)
libICE.so.6 => /usr/lib/x86_64-linux-gnu/libICE.so.6 (0x00007f620c9d7000)
libXi.so.6 => /usr/lib/x86_64-linux-gnu/libXi.so.6 (0x00007f620c7c6000)
libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f620c5a8000)
libv4lconvert.so.0 => /usr/lib/x86_64-linux-gnu/libv4lconvert.so.0 (0x00007f620c332000)
libogg.so.0 => /usr/lib/x86_64-linux-gnu/libogg.so.0 (0x00007f620c12b000)
liborc-0.4.so.0 => /usr/lib/x86_64-linux-gnu/liborc-0.4.so.0 (0x00007f620beaf000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f620bc85000)
libXt.so.6 => /usr/lib/x86_64-linux-gnu/libXt.so.6 (0x00007f620ba1e000)
libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f620b81b000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f620b5de000)
libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f620b3d5000)
libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007f620b1d0000)
libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f620afca000)
答案 0 :(得分:1)
为了安全起见,在libcudart.so.6.5和libcudart.so.6.0之间创建一个符号链接。
sudo ln -s /usr/local/cuda/lib64/libcudart.so.6.5 /usr/local/cuda/lib64/libcudart.so.6.0