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

时间:2021-08-02 23:44:44

I use Ubuntu 16.04, gcc 5.4.0 and CLion (C++ environment). I am trying to use caffe. And it needs protobuf for installation. So, it works fine in Python, but C++ gives me a run-time exception:

我使用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".)

As far as I understood, exception tells me that it needs protobuf 2.6.1, but 3.3.0 is installed. But command apt-get upgrade libprotobuf-dev gives me libprotobuf-dev is already the newest version (2.6.1-1.3). so i do have 2.6.1.

据我所知,异常告诉我它需要protobuf 2.6.1,但安装了3.3.0。但命令apt-get upgrade libprotobuf-dev给我libprotobuf-dev已经是最新版本(2.6.1-1.3)。所以我确实有2.6.1。

Could you, please, advice me how could i fix it ?

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

P.S. I dont know if it is important or not but I added caffe path to ~/.bashrc

附:我不知道它是否重要但我添加了〜/ .bashrc的caffe路径

1 个解决方案

#1


0  

You can specify the version that you want to use in

您可以指定要使用的版本

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是否支持无论如何看看这个。

#1


0  

You can specify the version that you want to use in

您可以指定要使用的版本

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是否支持无论如何看看这个。