关于编译安装提示No package ** found时可能需配置pkg-config

在编译安装时,可能出现:

No package '**' 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 OPENSSL_CFLAGS
and OPENSSL_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

** 处显示的是 package 名,缺少某个 库/模块 则会显示其名称。

可通过 pkg-config --list-all 命令查看 package:

$ pkg-config --list-all
libecpg           libecpg - PostgreSQL libecpg library
libpng16          libpng - Loads and saves PNG files
libpq             libpq - PostgreSQL libpq library
oniguruma         oniguruma - Regular expression library
libpgtypes        libpgtypes - PostgreSQL libpgtypes library
libpcreposix      libpcreposix - PCREPosix - Posix compatible interface to libpcre
libxslt           libxslt - XSLT library version 2.
libzip            libzip - library for handling zip archives
libcurl           libcurl - Library to transfer files with ftp, http, etc.
libpng            libpng - Loads and saves PNG files
libmemcached      libmemcached - libmemcached C/C++ library.
libxml-2.0        libXML - libXML library version2.
libevent_core     libevent_core - libevent_core
libpcrecpp        libpcrecpp - PCRECPP - C++ wrapper for PCRE
libidn2           libidn2 - Library implementing IDNA2008 and TR46
openssl           OpenSSL - Secure Sockets Layer and cryptography libraries and tools
...

如果已经安装了提示的 库/模块,则需要手动添加 PKG_CONFIG_PATH;否则正常安装即可。

例如,已安装 openssl,但是编译 php7 时提示 “No package 'openssl' found”。

进入已安装的 库/模块 根路径,然后进入 lib/pkgconfig 目录,

$ cd lib/pkgconfig/
$ ls
libcrypto.pc	libssl.pc	openssl.pc

将 *.pc 文件软链到 /usr/local/lib/pkgconfig 目录下,然后再查看 pkg 列表里是否有了 openssl :

$ ln -s openssl.pc /usr/local/lib/pkgconfig/
$ pkg-config --list-all

如果出现在了列表里,则完成了。

没有出现,则需要配置 PKG_CONFIG_PATH

$ vim ~/.bash_profile 

PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig                        
export PKG_CONFIG_PATH

编辑添加后,让其立即生效:

$ source ~/.bash_profile

$ pkg-config --list-all

然后再查看 库/模块 管理列表,出现在列表中,则可继续编译...

也可能会存在 库/模块 安装目录中没有 pkgconfig/*.pc

那就需要手动建立,参考:pkg-config详解

 

  • 10
    点赞
  • 27
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值