C++ 在Ubuntu上使用caffe(C+;+;)时,Protobuf版本冲突

C++ 在Ubuntu上使用caffe(C+;+;)时,Protobuf版本冲突,c++,ubuntu-16.04,caffe,C++,Ubuntu 16.04,Caffe,我使用Ubuntu 16.04、gcc 5.4.0和CLion(C++环境)。 我想用咖啡。它需要protobuf来安装。 所以,它在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 com

我使用Ubuntu 16.04、gcc 5.4.0和CLion(C++环境)。 我想用咖啡。它需要protobuf来安装。 所以,它在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".)
据我所知,异常告诉我它需要protobuf 2.6.1,但安装了3.3.0。 但是命令
apt get upgrade libprotobuf dev
告诉我
libprotobuf dev已经是最新版本(2.6.1-1.3)
。所以我有2.6.1

你能告诉我怎么修吗


另外,我不知道它是否重要,但我将caffe路径添加到了~/.bashrc

您可以指定要在中使用的版本

咖啡根/cmake/Protobuf.cmake

通过在find_软件包中添加版本号:

find_package( Protobuf 2.6.1 REQUIRED )
这样你就可以保留多个版本了,没关系


Ps:我不确定3.3.0版是否受支持。看看。

您使用了多少protobuf版本?我想您可能已经单独安装了它们,您需要卸载libprotobuf dev并重新构建caffe。下面是我所做的。1) sudo-apt-get-remove-libprotobuf-dev-protobuf编译器2)sudo-apt-get-upgrade-libprotobuf-dev(确保它被删除)3)在caffe文件夹中:make-clean和make-all-In-end-CLion给出了相同的结果。这个protoc得到了什么——versionWOW,它真的给了我3.3.0。我将尝试删除这一个并再次重建caffe。我认为这一个将与caffe更兼容,您能尝试重新安装gcc吗