Caffe安装问题21_protoc version

2023-11-08 18:38

本文主要是介绍Caffe安装问题21_protoc version,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

1 编译错误

➜  caffe git:(zxdev_mac)make
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
/bin/sh: line 0: [: -gt: unary operator expected
/bin/sh: line 0: [: -gt: unary operator expected
CXX src/caffe/data_transformer.cpp
In file included from src/caffe/data_transformer.cpp:8:
In file included from ./include/caffe/data_transformer.hpp:6:
In file included from ./include/caffe/blob.hpp:9:
.build_release/src/caffe/proto/caffe.pb.h:17:2: 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: 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: regenerate this file with a newer version of protoc.
#error regenerate this file with a newer version of protoc.^
.build_release/src/caffe/proto/caffe.pb.h:1027:10: error: unknown type name 'PROTOBUF_CONSTEXPR'static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =^
.build_release/src/caffe/proto/caffe.pb.h:1027:29: error: expected member name or ';' after declaration specifiersstatic PROTOBUF_CONSTEXPR int const kIndexInFileMessages =~~~~~~~~~~~~~~~~~~~~~~~~~ ^
.build_release/src/caffe/proto/caffe.pb.h:1049:56: error: only virtual member functions can be marked 'final'::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;^~~~~~~~~~~~~~
/usr/local/include/google/protobuf/stubs/port.h:127:24: note: expanded from macro 'PROTOBUF_FINAL'
#define PROTOBUF_FINAL final^
In file included from src/caffe/data_transformer.cpp:8:
In file included from ./include/caffe/data_transformer.hpp:6:
In file included from ./include/caffe/blob.hpp:9:
.build_release/src/caffe/proto/caffe.pb.h:1051:64: error: only virtual member functions can be marked 'final'::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;^~~~~~~~~~~~~~
/usr/local/include/google/protobuf/stubs/port.h:127:24: note: expanded from macro 'PROTOBUF_FINAL'
#define PROTOBUF_FINAL final^
In file included from src/caffe/data_transformer.cpp:8:
In file included from ./include/caffe/data_transformer.hpp:6:
In file included from ./include/caffe/blob.hpp:9:
.build_release/src/caffe/proto/caffe.pb.h:1053:68: error: non-virtual member function marked 'final' hides virtual member functionbool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;^
/usr/local/include/google/protobuf/stubs/port.h:127:24: note: expanded from macro 'PROTOBUF_FINAL'
#define PROTOBUF_FINAL final^
/usr/local/include/google/protobuf/message.h:303:10: note: hidden overloaded virtual function 'google::protobuf::Message::InternalSerializeWithCachedSizesToArray' declared here: type mismatch at 1st parameter ('google::protobuf::uint8 *' (aka 'unsigned char *') vs 'bool')uint8* InternalSerializeWithCachedSizesToArray(^
In file included from src/caffe/data_transformer.cpp:8:
In file included from ./include/caffe/data_transformer.hpp:6:
In file included from ./include/caffe/blob.hpp:9:
.build_release/src/caffe/proto/caffe.pb.h:1141:10: error: unknown type name 'PROTOBUF_CONSTEXPR'static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =^
.build_release/src/caffe/proto/caffe.pb.h:1141:29: error: expected member name or ';' after declaration specifiersstatic PROTOBUF_CONSTEXPR int const kIndexInFileMessages =~~~~~~~~~~~~~~~~~~~~~~~~~ ^
.build_release/src/caffe/proto/caffe.pb.h:1163:56: error: only virtual member functions can be marked 'final'::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;^~~~~~~~~~~~~~
/usr/local/include/google/protobuf/stubs/port.h:127:24: note: expanded from macro 'PROTOBUF_FINAL'
#define PROTOBUF_FINAL final^
In file included from src/caffe/data_transformer.cpp:8:
In file included from ./include/caffe/data_transformer.hpp:6:
In file included from ./include/caffe/blob.hpp:9:
.build_release/src/caffe/proto/caffe.pb.h:1165:64: error: only virtual member functions can be marked 'final'::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;^~~~~~~~~~~~~~
/usr/local/include/google/protobuf/stubs/port.h:127:24: note: expanded from macro 'PROTOBUF_FINAL'
#define PROTOBUF_FINAL final^
In file included from src/caffe/data_transformer.cpp:8:
In file included from ./include/caffe/data_transformer.hpp:6:
In file included from ./include/caffe/blob.hpp:9:
.build_release/src/caffe/proto/caffe.pb.h:1167:68: error: non-virtual member function marked 'final' hides virtual member functionbool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;^
/usr/local/include/google/protobuf/stubs/port.h:127:24: note: expanded from macro 'PROTOBUF_FINAL'
#define PROTOBUF_FINAL final^
/usr/local/include/google/protobuf/message.h:303:10: note: hidden overloaded virtual function 'google::protobuf::Message::InternalSerializeWithCachedSizesToArray' declared here: type mismatch at 1st parameter ('google::protobuf::uint8 *' (aka 'unsigned char *') vs 'bool')uint8* InternalSerializeWithCachedSizesToArray(^
In file included from src/caffe/data_transformer.cpp:8:
In file included from ./include/caffe/data_transformer.hpp:6:
In file included from ./include/caffe/blob.hpp:9:
.build_release/src/caffe/proto/caffe.pb.h:1349:10: error: unknown type name 'PROTOBUF_CONSTEXPR'static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =^
.build_release/src/caffe/proto/caffe.pb.h:1349:29: error: expected member name or ';' after declaration specifiersstatic PROTOBUF_CONSTEXPR int const kIndexInFileMessages =~~~~~~~~~~~~~~~~~~~~~~~~~ ^
.build_release/src/caffe/proto/caffe.pb.h:1371:56: error: only virtual member functions can be marked 'final'::google::protobuf::io::CodedInputStream* input) PROTOBUF_FINAL;^~~~~~~~~~~~~~
/usr/local/include/google/protobuf/stubs/port.h:127:24: note: expanded from macro 'PROTOBUF_FINAL'
#define PROTOBUF_FINAL final^
In file included from src/caffe/data_transformer.cpp:8:
In file included from ./include/caffe/data_transformer.hpp:6:
In file included from ./include/caffe/blob.hpp:9:
.build_release/src/caffe/proto/caffe.pb.h:1373:64: error: only virtual member functions can be marked 'final'::google::protobuf::io::CodedOutputStream* output) const PROTOBUF_FINAL;^~~~~~~~~~~~~~
/usr/local/include/google/protobuf/stubs/port.h:127:24: note: expanded from macro 'PROTOBUF_FINAL'
#define PROTOBUF_FINAL final^
In file included from src/caffe/data_transformer.cpp:8:
In file included from ./include/caffe/data_transformer.hpp:6:
In file included from ./include/caffe/blob.hpp:9:
.build_release/src/caffe/proto/caffe.pb.h:1375:68: error: non-virtual member function marked 'final' hides virtual member functionbool deterministic, ::google::protobuf::uint8* target) const PROTOBUF_FINAL;^
/usr/local/include/google/protobuf/stubs/port.h:127:24: note: expanded from macro 'PROTOBUF_FINAL'
#define PROTOBUF_FINAL final^
/usr/local/include/google/protobuf/message.h:303:10: note: hidden overloaded virtual function 'google::protobuf::Message::InternalSerializeWithCachedSizesToArray' declared here: type mismatch at 1st parameter ('google::protobuf::uint8 *' (aka 'unsigned char *') vs 'bool')uint8* InternalSerializeWithCachedSizesToArray(^
In file included from src/caffe/data_transformer.cpp:8:
In file included from ./include/caffe/data_transformer.hpp:6:
In file included from ./include/caffe/blob.hpp:9:
.build_release/src/caffe/proto/caffe.pb.h:1462:10: error: unknown type name 'PROTOBUF_CONSTEXPR'static PROTOBUF_CONSTEXPR int const kIndexInFileMessages =^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [.build_release/src/caffe/data_transformer.o] Error 1

2 解决方法

可以看到这个文件是编译caffe时候生成的,并且它所要求的protobuf版本是2.6.0或2.6.1,高于或低于都会出现error

此时需要查看系统的protobuf的版本是多少:

命令行输入 protoc --version

显示:libprotoc 3.5.0

确实因为某次升级将protobuf的版本升级到了3.5.0,所以产生了上述error。

解决方案:

在caffe目录下重新编译:

make clean

make all -j4

然后如果需要将caffe相关的内容安装到系统目录则:

sudo make install

此时再次编译原来的工程,error消失,编译通过。

这篇关于Caffe安装问题21_protoc version的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/371763

相关文章

springboot循环依赖问题案例代码及解决办法

《springboot循环依赖问题案例代码及解决办法》在SpringBoot中,如果两个或多个Bean之间存在循环依赖(即BeanA依赖BeanB,而BeanB又依赖BeanA),会导致Spring的... 目录1. 什么是循环依赖?2. 循环依赖的场景案例3. 解决循环依赖的常见方法方法 1:使用 @La

Linux系统中卸载与安装JDK的详细教程

《Linux系统中卸载与安装JDK的详细教程》本文详细介绍了如何在Linux系统中通过Xshell和Xftp工具连接与传输文件,然后进行JDK的安装与卸载,安装步骤包括连接Linux、传输JDK安装包... 目录1、卸载1.1 linux删除自带的JDK1.2 Linux上卸载自己安装的JDK2、安装2.1

Linux卸载自带jdk并安装新jdk版本的图文教程

《Linux卸载自带jdk并安装新jdk版本的图文教程》在Linux系统中,有时需要卸载预装的OpenJDK并安装特定版本的JDK,例如JDK1.8,所以本文给大家详细介绍了Linux卸载自带jdk并... 目录Ⅰ、卸载自带jdkⅡ、安装新版jdkⅠ、卸载自带jdk1、输入命令查看旧jdkrpm -qa

MySQL Workbench 安装教程(保姆级)

《MySQLWorkbench安装教程(保姆级)》MySQLWorkbench是一款强大的数据库设计和管理工具,本文主要介绍了MySQLWorkbench安装教程,文中通过图文介绍的非常详细,对大... 目录前言:详细步骤:一、检查安装的数据库版本二、在官网下载对应的mysql Workbench版本,要是

SpringBoot启动报错的11个高频问题排查与解决终极指南

《SpringBoot启动报错的11个高频问题排查与解决终极指南》这篇文章主要为大家详细介绍了SpringBoot启动报错的11个高频问题的排查与解决,文中的示例代码讲解详细,感兴趣的小伙伴可以了解一... 目录1. 依赖冲突:NoSuchMethodError 的终极解法2. Bean注入失败:No qu

MySQL新增字段后Java实体未更新的潜在问题与解决方案

《MySQL新增字段后Java实体未更新的潜在问题与解决方案》在Java+MySQL的开发中,我们通常使用ORM框架来映射数据库表与Java对象,但有时候,数据库表结构变更(如新增字段)后,开发人员可... 目录引言1. 问题背景:数据库与 Java 实体不同步1.1 常见场景1.2 示例代码2. 不同操作

Linux安装MySQL的教程

《Linux安装MySQL的教程》:本文主要介绍Linux安装MySQL的教程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录linux安装mysql1.Mysql官网2.我的存放路径3.解压mysql文件到当前目录4.重命名一下5.创建mysql用户组和用户并修

如何解决mysql出现Incorrect string value for column ‘表项‘ at row 1错误问题

《如何解决mysql出现Incorrectstringvalueforcolumn‘表项‘atrow1错误问题》:本文主要介绍如何解决mysql出现Incorrectstringv... 目录mysql出现Incorrect string value for column ‘表项‘ at row 1错误报错

如何解决Spring MVC中响应乱码问题

《如何解决SpringMVC中响应乱码问题》:本文主要介绍如何解决SpringMVC中响应乱码问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录Spring MVC最新响应中乱码解决方式以前的解决办法这是比较通用的一种方法总结Spring MVC最新响应中乱码解

pip无法安装osgeo失败的问题解决

《pip无法安装osgeo失败的问题解决》本文主要介绍了pip无法安装osgeo失败的问题解决,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一... 进入官方提供的扩展包下载网站寻找版本适配的whl文件注意:要选择cp(python版本)和你py