当我使用CUDA和OPenCV编写程序时,只需编译(使用-c),但链接时会发出警告:
/usr/local/cuda-9.0/bin/nvcc -ccbin g++ -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_70,code=sm_70 -m64 -I /usr/local/include -I /usr/local/include/opencv -I /usr/local/include/opencv2 -lopencv_core -lopencv_highgui -lopencv_imgproc -o rgb smooth_tex.cu
5 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_70,code=sm_70 -m64 -I /usr/local/include -I /usr/local/include/opencv -I /usr/local/include/opencv2 -lopencv_core -lopencv_highgui -lopencv_imgproc -o rgb smooth_tex.cu
/usr/bin/ld: warning: libpcre.so.1, needed by //home/dzqiu/anaconda2/lib/libgobject-2.0.so.0, not found (try using -rpath or -rpath-link)
我很困惑,为什么它会链接anaconda2中的库?我检查了libgobject-2.0.so.0,发现它可能没问题:
但是当我运行rpm -ql pcre
时,会显示:
package pcre is not installed
我尝试安装libpcre3,但是它显示libpcre3已经是最新版本(2:8.38-3.1),但是没有在/ lib64,/ lib /,usr / local / lib /中,我尝试链接来自anaconda2的libpcre.so.1,但它不起作用。
我还添加了-L来链接OpenCV的库(/ usr / local / lib /)或anaconda2的库,但它没有用。
有任何修复建议吗?
答案 0 :(得分:1)
我遇到了类似的问题,尝试将anaconda的lib添加到LD_LIBRARY_PATH
:
$ export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:<your anaconda>/lib"
也许它可以解决它。