Home > Blockchain >  'libxslt not found' when build nginx with 'nginx-dav-ext-module' on windows
'libxslt not found' when build nginx with 'nginx-dav-ext-module' on windows

Time:07-07

I want to build nginx for windows with webdav module, so I followed the doc http://nginx.org/en/docs/howto_build_on_win32.html

Enviroment

  • Windows10
  • Microsoft Visual C Build Tools
  • msys2-x86_64-20220603.exe
  • strawberry-perl-5.32.1.1-64bit.msi

Step

Run script below using msys2

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

But an error ocurred:

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

I tried install libxslt using pacman -S mingw-w64-x86_64-libxslt, but with no luck.

How to solve this problem?

CodePudding user response:

The funny thing, I tried to do almost the same not less than a day ago. My conditions were somewhat different, I was (re)building an OpenResty bundle due to the need of the ngx_http_xslt_module. I also used msys2-x86_64-20220603, however my build toolchain was MinGW GCC 12.1.0 / MSYS2 make / etc. I basically faced the same problem, and solved it the following way.

  1. Install libxml2 and libxslt libraries from MinGW:
$ pacman -S mingw-w64-x86_64-libxml2
$ pacman -S mingw-w64-x86_64-libxslt
  1. Modify the auto/lib/libxslt/conf file, where rules to find libxml2/libxslt libraries header files and linkable objects are defined. Here is my patch to this file:
--- 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. Build an nginx executable. After the build is complete, the following DLLs from C:\MSYS64\mingw64\bin folder should be placed among the nginx.exe binary: libxslt-1.dll, libexslt-0.dll, libxml2-2.dll, libiconv-2.dll, liblzma-5.dll, zlib1.dll (last three are libxml2-2.dll dependencies).
  • Related