Welcome! Log In Create A New Profile

Advanced

Re: Compiling Nginx with `libdeflate` - possible?

Maxim Dounin
October 25, 2021 12:52PM
Hello!

On Mon, Oct 25, 2021 at 07:50:42AM -0400, petecooper wrote:

> I am attempting to compile Nginx 1.21.3 with libdeflate[1] with a view to
> comparing performance against classic Zlib and the Cloudflare fork of
> Zlib[2].
>
> I can successfully compile Nginx with classic Zlib. I can also successfully
> compile Nginx with Cloudflare Zlib. I cannot yet compile Nginx with
> libdeflate.
>
> I am falling down during Nginx `make` with this error:

[...]

> cd ../../libdeflate-source/libdeflate-1.8 \
> && make distclean \
> && CFLAGS="-O2 -fomit-frame-pointer -pipe " CC="cc" \
> ./configure \
> && make libz.a
> make[2]: Entering directory '/home/pete/libdeflate-source/libdeflate-1.8'
> make[2]: *** No rule to make target 'distclean'. Stop.
> make[2]: Leaving directory '/home/pete/libdeflate-source/libdeflate-1.8'
> make[1]: *** [objs/Makefile:3107:
> ../../libdeflate-source/libdeflate-1.8/libz.a] Error 2
> make[1]: Leaving directory '/home/pete/nginx-source/nginx-1.21.3'
> make: *** [Makefile:10: build] Error 2
> --8<--
>
> I confirm the directory `/home/pete/libdeflate-source/libdeflate-1.8` has
> the Makefile and is readable by Nginx make.
>
> Compiling libdeflate in isolation outside of Nginx with `make distclean`
> throws the same error:

[...]

> Question #0: Am I attempting the impossible here?
> Question #1: Is there a way to persuade libdeflate in its current state to
> compile with Nginx?
> Question #2: Is there something I should be raising on the libdeflate
> project side to achieve a compilation with Nginx?
>
> Thank you for reading, I am grateful for any advice and feedback.

It looks like you are trying to use "--with-zlib=..." configure
option to compile nginx with libdeflate. It is, however, designed
to compile zlib, and relies on zlib compilation procedure. It
might not work (and, actually, not expected to work) with other
libraries even if these libraries provide a zlib-compatible
interface.

Similarly, you cannot compile nginx with BoringSSL with
"--with-openssl=...", because BoringSSL use build system quite
different from OpenSSL's one.

Consider instead compiling libdeflate yourself, and building nginx
with appropriate --with-cc-opt="-I/path/to/include" and
--with-ld-opt="-I/path/to/lib" to provide paths to the libdeflate
includes and library files. This might work as long as libdeflate
provides zlib-compatible interfaces.

Note though that libdeflate does not seem to provide a
zlib-compatible interface, its README.md says "libdeflate has a
simple API that is not zlib-compatible". That is, using
libdeflate instead of zlib is not going to work without rewriting
the code to use libdeflate API.

Further, README.md says that "There is currently no support for
streaming". This means it is not usable in nginx (well, certainly
one can write a module which uses it, but this will be something
very different from the nginx gzip filter module).

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Compiling Nginx with `libdeflate` - possible?

petecooper October 25, 2021 07:50AM

Re: Compiling Nginx with `libdeflate` - possible?

Maxim Dounin October 25, 2021 12:52PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 62
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready