Caffe-GPU编译问题:/usr/bin/ld:cannot find -lopencv_imgcodecs

本文介绍了解决在Ubuntu 16.04环境下使用OpenCV 3.4.1时遇到的库文件未导入问题的具体步骤。通过手动添加缺失的libopencv_imgcodecs.so库文件到ld配置中,解决了编译时找不到该库的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

我的系统的环境:

GPU服务器 ubuntu16.04
Opencv3.4.1
CUDA 9.0
CUDNN v7

出现的问题:

在这里插入图片描述
这说明是库文件没有导入ld检索目录中。
对于

/usr/bin/ld: cannot find -lxxx

其中xxx即表示函式库文件名称
其命名规则是:lib+库名(即xxx)+.so。
因此,此问题中缺少的就是libopencv_imgcodecs.so这个库文件的链接。
此文件的链接是在opencv文件夹的lib下,因此运行:

sudo ldconfig /usr/local/opencv341/lib/libopencv_imgcodecs.so

其中的opencv341是我自己的opencv安装的目录,这个要根据自己的情况进行修改。
修改完毕后,在运行make ,就不报错了。

(openpose) root@cnshaw2404:~/Workspace/openpose/build# cmake .. -DBUILD_PYTHON=true -DUSE_CUDNN=off -- The C compiler identification is GNU 10.5.0 -- The CXX compiler identification is GNU 10.5.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- GCC detected, adding compile flags -- GCC detected, adding compile flags -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE -- Found CUDA: /usr/local/cuda-11.8 (found version "11.8") -- Building with CUDA. -- CUDA detected: 11.8 -- Added CUDA NVCC flags for: sm_86 -- cuDNN not found -- Found GFlags: /usr/include -- Found gflags (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libgflags.so) -- Found Glog: /usr/include -- Found glog (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libglog.so) CMake Warning at /root/miniconda3/envs/openpose/share/cmake-3.24/Modules/FindProtobuf.cmake:524 (message): Protobuf compiler version 3.20.3 doesn't match library version 3.21.12 Call Stack (most recent call first): CMakeLists.txt:429 (find_package) -- Found Protobuf: /usr/local/lib/libprotobuf.so (found version "3.21.12") -- Found OpenCV: /usr (found version "4.6.0") -- Caffe will be downloaded from source now. NOTE: This process might take several minutes depending on your internet connection. -- Caffe has already been downloaded. Previous HEAD position was b5ede488 Added TX2 JetPack3.3 support HEAD is now at 1807aada Added Ampere arch's (CUDA11) -- Caffe will be built from source now. -- Download the models. -- Downloading BODY_25 model... -- Model already exists. -- Not downl
最新发布
03-15
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值