Welcome! Log In Create A New Profile

Advanced

Compiling Nginx with `libdeflate` - possible?

October 25, 2021 07:50AM
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:

--8<--
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -m64 -march=native -mtune=native -DTCP_FASTOPEN=23 -g -O3 -fstack-protector-strong -flto -ffat-lto-objects -fuse-ld=gold --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wimplicit-fallthrough=0 -Wno-deprecated-declarations -fcode-hoisting -Wp,-D_FORTIFY_SOURCE=2 -Wno-deprecated-declarations -DNDK_SET_VAR -DNDK_UPSTREAM_LIST -D_GLIBCXX_USE_CXX11_ABI=0 -I src/core -I src/event -I src/event/modules -I src/os/unix -I ../../brotli-source//deps/brotli/c/include -I ../../devel-kit-source/ngx_devel_kit-0.3.1/objs -I objs/addon/ndk -I ../../devel-kit-source/ngx_devel_kit-0.3.1/src -I ../../devel-kit-source/ngx_devel_kit-0.3.1/objs -I objs/addon/ndk -I ../../pagespeed-source/incubator-pagespeed-ngx-1.13.35.2-stable/psol/include -I ../../pagespeed-source/incubator-pagespeed-ngx-1.13.35.2-stable/psol/include/third_party/chromium/src -I ../../pagespeed-source/incubator-pagespeed-ngx-1.13.35.2-stable/psol/include/third_party/google-sparsehash/src/src -I ../../pagespeed-source/incubator-pagespeed-ngx-1.13.35.2-stable/psol/include/third_party/google-sparsehash/gen/arch/linux/x64/include -I ../../pagespeed-source/incubator-pagespeed-ngx-1.13.35.2-stable/psol/include/third_party/grpc/src/include -I ../../pagespeed-source/incubator-pagespeed-ngx-1.13.35.2-stable/psol/include/third_party/protobuf/src/src -I ../../pagespeed-source/incubator-pagespeed-ngx-1.13.35.2-stable/psol/include/third_party/re2/src -I ../../pagespeed-source/incubator-pagespeed-ngx-1.13.35.2-stable/psol/include/out/Release/obj/gen -I ../../pagespeed-source/incubator-pagespeed-ngx-1.13.35.2-stable/psol/include/out/Release/obj/gen/protoc_out/instaweb -I ../../pagespeed-source/incubator-pagespeed-ngx-1.13.35.2-stable/psol/include/third_party/apr/src/include -I ../../pagespeed-source/incubator-pagespeed-ngx-1.13.35.2-stable/psol/include/third_party/aprutil/src/include -I ../../pagespeed-source/incubator-pagespeed-ngx-1.13.35.2-stable/psol/include/third_party/apr/gen/arch/linux/x64/include -I ../../pagespeed-source/incubator-pagespeed-ngx-1.13.35.2-stable/psol/include/third_party/aprutil/gen/arch/linux/x64/include -I ../../pagespeed-source/incubator-pagespeed-ngx-1.13.35.2-stable/psol/include/url -I ../../openssl-source/openssl-openssl-3.0.0/.openssl/include -I ../../libdeflate-source/libdeflate-1.8 -I /usr/include/libxml2 -I objs \
-o objs/ngx_modules.o \
objs/ngx_modules.c
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:

--8<--
No rule to make target 'distclean'
--8<--

There is no reference to distclean in the libdeflate Makefile[3], so I am at a dead end.

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.

[1] https://github.com/ebiggers/libdeflate

[2] https://github.com/cloudflare/zlib

[3] https://github.com/ebiggers/libdeflate/blob/master/Makefile
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: 300
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready