PHP 编译错误 Package requirements (libzip >= 0.11) were not met

Linux 2020-05-27 阅读 116 评论 0

问题描述

在 Linux 编译 php-7.4.6,./configure --prefix=/opt/php-7.4.6 --enable-fpm --with-curl --with-zip --with-pdo-mysql --with-mysqli,最后出现以下错误。

checking for libzip >= 0.11... no
configure: error: Package requirements (libzip >= 0.11) were not met:

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

解决方法

需要安装 libzip-devel,可以手动安装或者命令行安装。

1. 手动安装

https://pkgs.org/search/?q=libzip 页面中,找到与操作系统相对应的 libzip-devel 版本,并下载安装。

注意对于一些 Linux 操作系统,如在 Centos 7 中,官方 CentOS x86_64 存储库上的  libzip / libzip-devel 软件包仍是 0.10,不符合编译要求,因此只能手动安装,可以下载非官方库,比如 remi 仓库,libzip5-1.6.1-1.el7.remi.x86_64.rpmlibzip5-devel-1.6.1-1.el7.remi.x86_64.rpm,下载后运行:

$ sudo yum install ./libzip5-1.6.1-1.el7.remi.x86_64.rpm
$ sudo yum install ./libzip5-devel-1.6.1-1.el7.remi.x86_64.rpm

2. 命令行安装

Ubuntu / Debian

sudo apt-get install libzip-dev

RHEL / CentOS 8

sudo yum install libzip-devel

Mac OS

brew install libzip
最后更新 2020-06-06
MIP.watch('startSearch', function (newVal, oldVal) { if(newVal) { var keyword = MIP.getData('keyword'); console.log(keyword); // 替换当前历史记录,新增 MIP.viewer.open('/s/' + keyword, {replace: true}); setTimeout(function () { MIP.setData({startSearch: false}) }, 1000); } }); MIP.watch('goHome', function (newVal, oldVal) { MIP.viewer.open('/', {replace: false}); });