ubuntu安装protobuf

 

这个安装没成功:

参考:https://blog.csdn.net/Zyong139064359/article/details/102543602 

如果是Ubuntu子系统,在clone开始就在子系统操作,否则后期会出现找不到文件的错误

1.sudo apt-get install autoconf automake libtool curl make g++ unzip

2.git clone https://github.com/protocolbuffers/protobuf.git

https://gitee.com/jacke121/protobuf2020.git

 

3.cd protobuf/

4.git submodule update --init --recursive

 

cd protobuf

chmod +x ./autogen.sh

./autogen.sh

./configure
make
make check
sudo make install

sudo ldconfig

5.检查是否安装成功

protoc --version

安装成功会显示版本信息,安装失败会提示错误信息,不出意外,又报错了。。。。。。错误信息:

protoc —versionprotoc: error while loading shared libraries: libprotoc.so.17: cannot open shared object file: No such file or directory

这是Ubuntu安装protobuf常见的一种问题,原因是:protobuf的默认安装路径是/usr/local/lib,而/usr/local/lib 不在Ubuntu体系默认的 LD_LIBRARY_PATH 里,所以就找不到该lib[2]。解决方法,在/usr/lib下创建protocol buffer相关库的软链接:

cd /usr/lib

sudo ln -s /usr/local/lib/libprotobuf.so.23 libprotobuf.so.23

sudo ln -s /usr/local/lib/libprotoc.so.23 libprotoc.so.23

至此,protobuf安装成功,但是想要在python中使用,还要编译python接口

protoc --version

libprotoc 3.12.3

 

参考:https://blog.csdn.net/tropicofcancer9/article/details/96306797

  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
安装ProtobufUbuntu上可以按照以下步骤进行: 1. 打开终端,运行以下命令以安装所需的依赖项: ``` sudo apt-get install autoconf automake libtool curl make g++ unzip ``` 2. 克隆Protobuf的源代码,并进入源代码目录: ``` git clone https://github.com/google/protobuf.git cd protobuf ``` 3. 初始化和更新子模块并生成配置文件: ``` git submodule update --init --recursive ./autogen.sh ``` 4. 执行配置命令,生成Makefile: ``` ./configure ``` 5. 使用make命令编译Protobuf: ``` make ``` 6. (可选)运行make check命令进行测试。如果没有克隆子模块,测试可能会失败,但仍然可以继续安装。运行make install命令安装Protobuf: ``` make check sudo make install ``` 以上是在Ubuntu安装Protobuf的一般步骤。根据你的操作系统版本和其他特定条件,可能会有一些差异。如果你遇到任何问题,你可以参考引用提供的链接中详细的问题解决方法。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [ubuntuprotobuf安装使用(详解)](https://blog.csdn.net/m0_46392035/article/details/124697124)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *3* [在 Ubuntu安装 Protobuf 3 的教程详解](https://download.csdn.net/download/weixin_38672800/12842115)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

AI算法网奇

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值