Nginx won't build with xslt into static linked binary

Kevin Weis nginx-4dk5spqe at compilenix.org
Sun Feb 12 16:31:30 UTC 2023


Hi,
I aim to build nginx from source, statically linked, and run into issues 
when `http_xslt_module` is enabled or I'm building with NJS 0.7.10 
(which also needs xslt).

I've created a simplified docker build to debug this issue at 
https://git.compilenix.org/CompileNix/docker-nginx-static

The error occures while running `./auto/configure` if 
`--with-ld-opt="-static"` is added. The build succeeds without it 
(remove line 176 from Dockerfile).

The configure ends with:
```
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

./auto/configure: error: the HTTP XSLT module requires the libxml2/libxslt
libraries. You can either do not enable the module or install the libraries.
```

The issue is not that libxml2 and libxslt aren't installed, they are.

I've looked into why libxslt is reported to be "not found" by inspecting 
the configure log file `objs/autoconf.err`, which shows the following error:
``
checking for libxslt

/usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: 
/usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../lib/libxml2.a(libxml2_la-xmlIO.o): 
in function `xmlFreeZMemBuff':
/home/buildozer/aports/main/libxml2/src/libxml2-2.10.3/xmlIO.c:1482: 
undefined reference to `deflateEnd'
/usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: 
/usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../lib/libxml2.a(libxml2_la-xmlIO.o): 
in function `xmlGzfileOpenW':
/home/buildozer/aports/main/libxml2/src/libxml2-2.10.3/xmlIO.c:1172: 
undefined reference to `gzdopen'

<for more see full build log linked below>
```

Here is the full build log: 
https://compilenix.org/static/95Yeyaxv/build-static.log

If you are wondering why I also build libxslt from source instead of 
using the alpine `libxslt-dev` package.. `libxslt-dev` does not contain 
"libxslt.a", which is required for static linking.

Additionally: I've also looked into other distros like ubuntu, fedora or 
gentoo. None of them install "libxslt.a" and show the same configure 
error messages.

Steps to reproduce:
```
git clone https://git.compilenix.org/CompileNix/docker-nginx-static.git
cd docker-nginx-static
./build.sh -t docker-nginx-static --no-cache | tee build.log
```

Any help, suggestions or hints are very welcome :)

-- 
Best regards
Kevin Weis
Pronouns: he / him

https://compilenix.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0x3B3F8B753D8DDB10.asc
Type: application/pgp-keys
Size: 1371 bytes
Desc: OpenPGP public key
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20230212/5ae20607/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 236 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20230212/5ae20607/attachment-0001.bin>


More information about the nginx mailing list