在编译安装时,可能出现:
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详解