安装过程中会出现以下错误
fatal error: too many errors emitted, stopping now [-ferror-limit=]
9 warnings and 20 errors generated.
make[2]: *** [atomicops_internals_x86_gcc.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
完整安装流程
1. 下载安装包
下载地址:https://github.com/protocolbuffers/protobuf/releases/tag/v2.5.0
2. 下载下来后解压压缩包,并进入目录
tar -xzvf protobuf-2.5.0.tar.gz
cd protobuf-2.5.0
3. 编辑 platform_macros.h 文件
文件地址:src/google/protobuf/stubs/platform_macros.h
添加下面信息:
#elif defined(__arm64__)
#define GOOGLE_PROTOBUF_ARCH_ARM 1
#define GOOGLE_PROTOBUF_ARCH_64_BIT 1
- 安装检测
make check
- 安装及编译
make && make install
- 配置环境变量
vim ~/.bash_profile
在文件结尾添加环境变量
export PROTOBUF=/usr/local/protobuf
export PATH=$PATH:$PROTOBUF/bin
- 生效
使用source命令,使配置文件生效
source ~/.bash_profile
- 验证
protoc --version
参考文章:
ProtoBuf2.5.0 Mac M1 cpu make failed · Issue #8836 · protocolbuffers/protobuf
本文档详细介绍了在Mac M1芯片上安装Protocol Buffers(Protobuf)v2.5.0时遇到的错误及解决步骤。首先从指定链接下载安装包并解压,然后在`platform_macros.h`文件中添加针对ARM64架构的定义。接着进行编译检查和安装,但编译过程中出现`fatal error: too many errors emitted, stopping now [-ferror-limit=]`等错误,导致安装失败。为解决这个问题,可以尝试更新编译器或查找其他兼容性解决方案。最后,配置环境变量并验证安装成功。
938

被折叠的 条评论
为什么被折叠?



