我正在尝试安装 Caffe 库,但由于系统中安装了错误的 protobuf 版本,我遇到了编译问题。
In file included from .build_release/src/caffe/proto/caffe.pb.cc:5:0:
.build_release/src/caffe/proto/caffe.pb.h:17:2: error: #error This file was generated by an older version of protoc which is
#error This file was generated by an older version of protoc which is
^
.build_release/src/caffe/proto/caffe.pb.h:18:2: error: #error incompatible with your Protocol Buffer headers. Please
#error incompatible with your Protocol Buffer headers. Please
^
.build_release/src/caffe/proto/caffe.pb.h:19:2: error: #error regenerate this file with a newer version of protoc.
#error regenerate this file with a newer version of protoc.
我遵循了论坛中提出的许多方法,我认为这篇文章中讨论了最相似的问题。
在 caffe.pb.h 中,控件是:
#if 3002000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
#endif
但是在我的系统头文件(/usr/include/google/protobuf/stubs/common.h)中:
The current version, represented as a single integer to make comparison
easier: major * 10^6 + minor * 10^3 + micro
define GOOGLE_PROTOBUF_VERSION 2005000
从终端命令 protoc --version 返回 libprotoc 3.2.0。
所以我已经安装了 3.2 版本,但是系统头文件没有更新。上一篇文章中的一位用户评论说:“我想出了一种方法,首先在 PATH 变量中指定我想要的 protobuf,而不必删除其他版本的 protobuf(其他事情取决于那个旧版本)。”
有人可以逐步解释我如何遵循这个吗?或者我可以更新系统标题吗?有许多元素连接到 libprotoc,所以我想避免损坏它们。
谢谢