Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build for windows libxslt not found #70

Open
ifreeswan opened this issue May 10, 2023 · 1 comment
Open

build for windows libxslt not found #70

ifreeswan opened this issue May 10, 2023 · 1 comment

Comments

@ifreeswan
Copy link

build nginx for windows with dav-ext-module
win10
vs2022
mysys2
http://nginx.org/en/docs/howto_build_on_win32.html

libxslt error
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

this answer is not can't solve the problem
https://stackoverflow.com/questions/72880182/libxslt-not-found-when-build-nginx-with-nginx-dav-ext-module-on-windows
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 checking for libxslt in /mingw64/ ... not found
How to solve this problem?
Thanks

@SinGao-SMPL
Copy link

Hi, I had the same problem yesterday and found that this issuse is not closed.
I hope I can help you by sharing my solution.

The first thing to point out is that while libxslt and libxml2 can be easily installed in the msys2 environment, vs2022 is not well recognized even if you manually add their locations to the obj/Makefile.
However, installing libxslt and libxml2 in vs2022 is cumbersome and unnecessary.

So we can build the build toolchain we need directly in Mysys2 w64.

  1. Install and libraries from MinGW: gcc make libxml2 libxslt.
    $ pacman -S mingw-w64-x86_64-gcc
    $ pacman -S mingw-w64-x86_64-make
    $ pacman -S mingw-w64-x86_64-libxml2
    $ pacman -S mingw-w64-x86_64-libxslt

  2. Modify the "nginx-x.x.x-RELEASE/auto/lib/libxslt/conf" file.
    -Because scripts in nginx cannot correctly validate libxml2 and libxslt in the msys2 w64 environment.
    -So delete everything related to validation and modify ngx_feature_path to the correct path.

    ngx_feature="libxslt"
    ngx_feature_name=
    ngx_feature_run=no
    ngx_feature_incs=""
    ngx_feature_path="/mingw64/include/libxml2"
    ngx_feature_libs="-lxml2 -lxslt"
    ngx_feature_test=""
    . auto/feature
    CORE_INCS="$CORE_INCS $ngx_feature_path"
    CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
    NGX_LIB_LIBXSLT=$ngx_feature_libs
    ngx_feature="libexslt"
    ngx_feature_name=NGX_HAVE_EXSLT
    ngx_feature_run=no
    ngx_feature_incs="#include <libexslt/exslt.h>"
    ngx_feature_path="/mingw64/include/libxml2"
    ngx_feature_libs="-lexslt"
    ngx_feature_test="exsltRegisterAll();"
    . auto/feature
    CORE_LIBS="$CORE_LIBS -lexslt"
    NGX_LIB_LIBXSLT="$NGX_LIB_LIBXSLT -lexslt"

  3. Then run ./configure.You can refer to the following.
    auto/configure \
    --crossbuild=win32 \
    --with-cc=gcc \
    --without-http_rewrite_module \
    --without-http_gzip_module \
    --with-http_dav_module \
    --add-module=./Lib/nginx-dav-ext-module-3.0.0

  4. After successfully building the nginx executable, you need to copy the libxslt-1.dll and libxml2-2.dll to the same location as the nginx executable.They're usually in /mingw64/bin/.

Have a good day

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants