发布
社区首页 >问答首页 >当在windows上使用‘nginx -dav-ext-模块’构建nginx时,“'libxslt未找到”

当在windows上使用‘nginx -dav-ext-模块’构建nginx时,“'libxslt未找到”
EN

Stack Overflow用户
提问于 2022-07-06 08:27:30
回答 1查看 93关注 0票数 0

我想用webdav模块为windows构建nginx,所以我遵循了doc http://nginx.org/en/docs/howto_build_on_win32.html

环境

  • Windows10
  • Microsoft可视化C++构建Tools
  • msys2-x86_64-20220603.exe
  • strawberry-perl-5.32.1.1-64bit.msi

Step

使用msys2运行下面的脚本

代码语言:javascript
代码运行次数:0
复制
cd /d/source/nginx

hg clone http://hg.nginx.org/nginx

tar -xzf ../pcre-8.45.tar.gz
tar -xzf ../zlib-1.2.12.tar.gz
tar -xzf ../openssl-1.1.1q.tar.gz
git clone https://github.com/arut/nginx-dav-ext-module.git ../nginx-dav-ext-module


auto/configure --with-cc=cl --builddir=objs \
--with-debug --prefix= --conf-path=conf/nginx.conf \
--pid-path=logs/nginx.pid --http-log-path=logs/access.log \
--error-log-path=logs/error.log --sbin-path=nginx.exe \
--http-client-body-temp-path=temp/client_body_temp \
--http-proxy-temp-path=temp/proxy_temp \
--http-fastcgi-temp-path=temp/fastcgi_temp \
--http-scgi-temp-path=temp/scgi_temp \
--http-uwsgi-temp-path=temp/uwsgi_temp \
--with-cc-opt=-DFD_SETSIZE=1024 \
--with-pcre=../pcre-8.45 \
--with-zlib=../zlib-1.2.12 \
--with-select_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_stub_status_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_auth_request_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_slice_module \
--with-mail \
--with-stream \
--with-openssl=../openssl-1.1.1q \
--with-openssl-opt=no-asm \
--with-http_ssl_module \
--with-mail_ssl_module \
--with-stream_ssl_module \
--add-module=../nginx-dav-ext-module

但是一个错误引起了:

代码语言:javascript
代码运行次数:0
复制
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

我试着使用pacman -S mingw-w64-x86_64-libxslt安装libxslt,但没有成功。

如何解决这个问题?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-07-06 15:36:37

有趣的是,我至少在一天前试着做同样的事情。我的条件有点不同,由于ngx_http_xslt_module的需要,我正在(重新)构建一个ngx_http_xslt_module包。我还使用了msys2-x86_64-20220603,但是我的构建工具链是MinGW GCC 12.1.0 / MSYS2 make /等。

  1. 从MinGW:

安装libxml2libxslt

代码语言:javascript
代码运行次数:0
复制
$ pacman -S mingw-w64-x86_64-libxml2
$ pacman -S mingw-w64-x86_64-libxslt

  1. 修改auto/lib/libxslt/conf文件,其中定义了查找libxml2/libxslt库头文件和可链接对象的规则。下面是我对这个文件的修补程序:

代码语言:javascript
代码运行次数:0
复制
--- conf
+++ conf
@@ -73,6 +73,23 @@
 fi
 
 
+if [ $ngx_found = no ]; then
+
+    # MinGW64
+
+    ngx_feature="libxslt in /mingw64/"
+    ngx_feature_path="/mingw64/include/libxml2 /mingw64/include"
+
+    if [ $NGX_RPATH = YES ]; then
+        ngx_feature_libs="-R/mingw64/lib -L/mingw64/lib -lxml2 -lxslt"
+    else
+        ngx_feature_libs="-L/mingw64/lib -lxml2 -lxslt"
+    fi
+
+    . auto/feature
+fi
+
+
 if [ $ngx_found = yes ]; then
 
     CORE_INCS="$CORE_INCS $ngx_feature_path"
@@ -156,6 +173,23 @@
 fi
 
 
+if [ $ngx_found = no ]; then
+
+    # MinGW64
+
+    ngx_feature="libexslt in /mingw64/"
+    ngx_feature_path="/mingw64/include/libxml2 /mingw64/include"
+
+    if [ $NGX_RPATH = YES ]; then
+        ngx_feature_libs="-R/mingw64/lib -L/mingw64/lib -lexslt"
+    else
+        ngx_feature_libs="-L/mingw64/lib -lexslt"
+    fi
+
+    . auto/feature
+fi
+
+
 if [ $ngx_found = yes ]; then
     if [ $USE_LIBXSLT = YES ]; then
         CORE_LIBS="$CORE_LIBS -lexslt"

  1. 构建了一个nginx可执行文件。构建完成后,应该将C:\MSYS64\mingw64\bin文件夹中的以下DLL放在nginx.exe二进制文件中:libxslt-1.dlllibexslt-0.dlllibxml2-2.dlllibiconv-2.dllliblzma-5.dllzlib1.dll (最后三个是libxml2-2.dll zlib1.dll)
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72880182

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档