安装protobuf-c执行./configure时遇到的问题解决办法

问题报错:
configure: error: Package requirements (protobuf >= 2.6.0) were not met:

No package 'protobuf' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables protobuf_CFLAGS
and protobuf_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

(1)问题出现:
    安装protobuf-c是,我们需要首先安装protobuf, 此外还需要通过protobuf-c对 之前安装的protobuf的版本认证。 我们当前开发所使用的是
protobuf2.6.0  以及protobuf-c 1.1.1 。 

protobuf-c 1.1.1  Package requirements (protobuf >= 2.6.0)

 

Proctobuf 安装步骤

tar zxvf protobuf-2.3.0.tar.gz

cd protobuf-2.4.1

./configure --prefix=/usr/local

make

sudo make install

在/etc/ld.so.conf 中添加一行: /usr/local/lib,保存退出

/sbin/ldconfig -v

 

 

 

Proctobuf-c 安装步骤,版本要一直,前提:Proctobuf-c 1.1.1版本需要protoc版本再2.6.0+

 

tar zxvf protobuf-c-0.15.tar.gz

cd protobuf-c-0.15

./configure --prefix=/usr/local(此时就会报上诉问题)

make

sudo make install


在执行./configure --prefix=/usr/local(此时就会报上诉问题) 就会报出 开头的问题。 

(2)问题原因:
    是在给protobuf-c进行环境配置的时候,查找不到上一步所安装protobuf的库文件,而这些库文件又是通过pkgconfig配置进行查找的。 该配置文件此时是在/usr/local/lib/pkgconfig/下 ,也就是问题中所提示的:Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.  。所以我们只需要将PKG_CONFIG_PATH 指定到/usr/local/lib/pkgconfig/即可。

(3)解决办法:
在命令行执行命令: export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
然后在configure目录下执行./configure --prefix=/usr/local 即可编译通过,然后make&make install 即可完整使用c语言版本的protobuf-c 环境了!!!

测试protobuf-c
执行下面的命令,无报错,去查看下生成文件即可。

 

cd ..

protoc-c --c_out=./ protobuf-c-0.15/src/test/test.proto


 
posted @   LiuYanYGZ  阅读(3836)  评论(0编辑  收藏  举报
编辑推荐:
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
历史上的今天:
2016-12-27 如何让程序(如java Hello)只启动一次?
点击右上角即可分享
微信分享提示