PHP 7.4 编译错误 configure: error: The pkg-config script could not be found or is too old
问题描述
在 Linux 下编译 PHP 7.4.9 源码,运行以下命令。
$ ./configure --prefix=/opt/php-7.4.9 --enable-fpm --with-pdo-mysql --with-zip --with-curl --enable-mbstring
最后报错了。
configure: error: The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
Alternatively, you may set the environment variables LIBXML_CFLAGS
and LIBXML_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See `config.log' for more details
解决方法
需要安装 pkg-config
。
Ubuntu/Debian
apt install pkg-config
Redhat/Centos
sudo yum install -y pkgconfig
Archlinux OS
pacman -S pkgconf
Mac OS
brew install pkg-config