"./configure: error: HTTP XSLT模块需要libxml2/libxslt库"

8
我最近将我的Mac OS升级到Mojave版本。我之前使用的是Nginx,在升级操作系统之前一直能够正常工作,但是在升级之后就无法启动Nginx了。因此,我尝试重新安装Nginx,但首先出现了c编译器错误。于是我下载了Xcode命令行工具,问题得以解决。然而现在又出现了libxml2/libxslt库找不到的错误。我尝试使用brew安装这些库,但仍然遇到相同的错误。我不确定出了什么问题。
我已经通过brew install命令下载了libxml2和libxslt库。
以下是我的configure脚本。
./configure \
--prefix=/opt/nginx/$NGINX_NAME_VERSION \
--pid-path=/var/run/nginx.pid \
--conf-path=/etc/nginx/$NGINX_NAME_VERSION/conf/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--lock-path=/var/lock/nginx.lock \
--http-client-body-temp-path=/var/tmp/nginx/body \
--http-fastcgi-temp-path=/var/tmp/nginx/fastcgi \
--http-proxy-temp-path=/var/tmp/nginx/proxy \
--http-scgi-temp-path=/var/tmp/nginx/scgi \
--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \
--with-debug \
--with-http_addition_module \
--with-http_dav_module \
--with-http_geoip_module \
--with-http_gzip_static_module \
--with-http_realip_module \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-http_sub_module \
--with-http_xslt_module \
--with-mail \
--with-mail_ssl_module \
--with-cc-opt=-I/usr/local/opt/openssl/include \
--with-ld-opt=-L/usr/local/opt/openssl/lib \
--builddir=$NGINX_BUILD_PATH

错误:
checking for OpenSSL library ... found
checking for zlib library ... found
checking for libxslt ... not found
checking for libxslt in /usr/local/ ... not found
checking for libxslt in /usr/pkg/ ... not found
checking for libxslt in /opt/local/ ... not found

您可以看到它能够找到OpenSSL、zlib,但无法找到libxslt。请有人帮助我解决这个问题。

2个回答

18

请尝试以下方法

sudo apt-get install libxslt-dev

您可能还需要

sudo apt-get install libgd-dev # for the "error: the HTTP image filter module requires the GD library." error
sudo apt-get install libgeoip-dev # for the GeoIP package

在 Fedora 33 上,这个不起作用。没有这样的库。通常的 libxslt 实际上已经安装了,但是 Nginx 仍然会出现这个错误。 - PKHunter

0
有时候你知道你已经安装了libxslt,但是nginx仍然在抱怨你没有安装。
实际问题并不在于是否安装了libxslt,而在于nginx能否成功链接到它。最终,我发现libxlst链接到我环境中安装的旧版本icu。我意识到我的libxml2太老了。升级了我的libxml2之后,一切都恢复正常了。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接