Chinaunix首页 | 论坛 | 博客
  • 博客访问: 67196
  • 博文数量: 13
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 115
  • 用 户 组: 普通用户
  • 注册时间: 2015-08-21 15:04
个人简介

好好努力

文章存档

2018年(2)

2015年(11)

我的朋友

分类: 服务器与存储

2015-09-14 14:11:04

问题报错:
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


阅读(15155) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~