简体   繁体   English

在Ubuntu上使用Caffe(C ++)时Protobuf版本冲突

[英]Protobuf version conflict when using caffe (C++) on Ubuntu

I use Ubuntu 16.04, gcc 5.4.0 and CLion (C++ environment). 我使用Ubuntu 16.04,gcc 5.4.0和CLion(C ++环境)。 I am trying to use caffe. 我正在尝试使用咖啡。 And it needs protobuf for installation. 并且它需要protobuf进行安装。 So, it works fine in Python, but C++ gives me a run-time exception: 因此,它在Python中工作正常,但是C ++给了我一个运行时异常:

libprotobuf FATAL google/protobuf/stubs/common.cc:78] This program was compiled against version 2.6.1 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.3.0). Contact the program author for an update. If you compiled the program yourself,  makesure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "/build/mir-ui6vjS/mir-0.26.3+16.04.20170605/obj-x86_64-linux-gnu/src/protobuf/mir_protobuf.pb.cc".)
    terminate called after throwing an instance of 'google::protobuf::FatalException'
    what(): This program was compiled against version 2.6.1 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.3.0). Contact the program author for an update. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "/build/mir-ui6vjS/mir-0.26.3+16.04.20170605/obj-x86_64-linux-gnu/src/protobuf/mir_protobuf.pb.cc".)

As far as I understood, exception tells me that it needs protobuf 2.6.1, but 3.3.0 is installed. 据我了解,exception告诉我它需要protobuf 2.6.1,但已安装3.3.0。 But command apt-get upgrade libprotobuf-dev gives me libprotobuf-dev is already the newest version (2.6.1-1.3) . 但是命令apt-get upgrade libprotobuf-dev给了我libprotobuf-dev is already the newest version (2.6.1-1.3) so i do have 2.6.1. 所以我确实有2.6.1。

Could you, please, advice me how could i fix it ? 请您告诉我我该如何解决?

PS I dont know if it is important or not but I added caffe path to ~/.bashrc PS我不知道这是否重要,但我在〜/ .bashrc中添加了caffe路径

You can specify the version that you want to use in 您可以指定要在其中使用的版本

CAFFE_ROOT/cmake/Protobuf.cmake CAFFE_ROOT / cmake的/ Protobuf.cmake

by adding the version number in find_package : 通过在find_package中添加版本号:

find_package( Protobuf 2.6.1 REQUIRED )

That way you can keep the multiple versions it doesn't matter. 这样,您可以保留多个版本,这无关紧要。

Ps : I'm not sure version 3.3.0 is supported anyway look at this . PS:我不知道3.3.0版本支持反正看看这个

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM