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

时间:2017-06-30 09:30:14

标签: c++ ubuntu-16.04 caffe

我使用Ubuntu 16.04,gcc 5.4.0和CLion(C ++环境)。 我正在尝试使用caffe。它需要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 is already the newest version (2.6.1-1.3)。所以我确实有2.6.1。

请问,请问我如何解决这个问题?

P.S。我不知道它是否重要,但我添加了caffe路径〜/ .bashrc

1 个答案:

答案 0 :(得分:0)

您可以在

中指定要使用的版本
  

CAFFE_ROOT / cmake的/ Protobuf.cmake

在find_package中添加版本号:

find_package( Protobuf 2.6.1 REQUIRED )

这样你可以保留多个不重要的版本。

Ps:我不确定版本3.3.0是否支持this