美文网首页
Mac M1安装protobuf-2.5.0

Mac M1安装protobuf-2.5.0

作者: GK_斯皮利特 | 来源:发表于2022-03-04 15:38 被阅读0次

    一、下载包 protobuf-2.5.0.tar.gz

    https://github.com/protocolbuffers/protobuf/releases/tag/v2.5.0

    二、解压包并修改文件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
    
    //定位到下面这两行
    #else
    #error Host architecture was not detected as supported by protobuf
    

    三、安装命令

    ./configure //默认安装到/usr/local
    
    make
    
    make check
    
    sudo make install
    
    protoc --version //查看是否安装成功
    

    四、卸载

    $ which protoc
      /usr/local/bin/protoc
    $ sudo rm /usr/local/bin/protoc

    相关文章

      网友评论

          本文标题:Mac M1安装protobuf-2.5.0

          本文链接:https://www.haomeiwen.com/subject/hnhmrrtx.html