install opencv error: ../../lib/libopencv_dnn.so.3.1.0: undefined reference to `google::protobuf:

本文介绍了解决在编译使用OpenCV的DNN模块时遇到的链接错误问题,特别是与Caffe预训练模型相关的GoogleNet模型的链接失败。提供了两种解决方案:一是尝试更新protobuf库;二是从源代码安装特定版本的protobuf。

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

 Error info:

Linking CXX executable ../../bin/example_dnn_caffe_googlenet

../../lib/libopencv_dnn.so.3.1.0: undefined reference to `google::protobuf::......so on


Solution:

Method 1: reinstall protobuf or upgrade.

  sudo apt-get install --upgrade libprotobuf-dev

 if false,please get into method 2.

Method 2: install protobuf by source,you need choose suitable version 

url https://github.com/google/protobuf/releases

decompression and enter directory

input command:

    ./autogen.sh

    ./configure --prefix=<your install path>

    make

    sudo make install

Get into your install path

add bin/  /include /lib to environment variables

or copy

    sudo cp bin/protoc /usr/bin

    sudo cp -r include/google /usr/include

    sudo cp -r lib/* /usr/lib


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值