安裝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


 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM