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

Does not compile on Debian 12 / Bookworm #146

Closed
lifeofguenter opened this issue Jul 14, 2023 · 5 comments
Closed

Does not compile on Debian 12 / Bookworm #146

lifeofguenter opened this issue Jul 14, 2023 · 5 comments

Comments

@lifeofguenter
Copy link

/tmp/ngx_brotli-master/deps/brotli/c/enc/encode.c:1473:20: error: argument 5 of type ‘const uint8_t *’ {aka ‘const unsigned char *’} declared as a pointer [-Werror=vla-parameter]
 1473 |     const uint8_t* input_buffer, size_t* encoded_size,
      |     ~~~~~~~~~~~~~~~^~~~~~~~~~~~
In file included from /tmp/ngx_brotli-master/deps/brotli/c/enc/encode.c:9:
/tmp/ngx_brotli-master/deps/brotli/c/include/brotli/encode.h:314:19: note: previously declared as a variable length array ‘const uint8_t[input_size]’ {aka ‘const unsigned char[input_size]’}
  314 |     const uint8_t input_buffer[BROTLI_ARRAY_PARAM(input_size)],
      |     ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/ngx_brotli-master/deps/brotli/c/enc/encode.c:1474:14: error: argument 7 of type ‘uint8_t *’ {aka ‘unsigned char *’} declared as a pointer [-Werror=vla-parameter]
 1474 |     uint8_t* encoded_buffer) {
      |     ~~~~~~~~~^~~~~~~~~~~~~~
/tmp/ngx_brotli-master/deps/brotli/c/include/brotli/encode.h:316:13: note: previously declared as a variable length array ‘uint8_t[*encoded_size]’ {aka ‘unsigned char[*encoded_size]’}
  316 |     uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(*encoded_size)]);
@NicolasCARPi
Copy link

NicolasCARPi commented Jul 15, 2023

I tried on the docker image, this works:

docker run --rm -it debian:bookworm bash
apt update && apt install -y build-essential git curl
git clone https://github.com/google/ngx_brotli/
cd ngx_brotli/
git submodule update --init
cd ..
curl -o nginx.tgz http://nginx.org/download/nginx-1.25.1.tar.gz
tar xzf nginx.tgz
cd nginx-1.25.1/
./configure --with-compat --without-http_rewrite_module --add-dynamic-module=../ngx_brotli --without-http_gzip_module
make modules
echo $?

What did you try?

See also #121

@jamesliu96
Copy link

jamesliu96 commented Aug 17, 2023

experiencing compilation failure with same errors with nginx-1.24.0 and nginx-1.25.2 on Ubuntu 22.04.3 LTS (GNU/Linux 5.15.0-79-generic x86_64)

nginx-1.24.0

# ./configure --with-compat --add-dynamic-module=/ngx_brotli
# make modules
...
cc -c -fPIC -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -g -O2 -ffile-prefix-map=/data/builder/debuild/nginx-1.24.0/debian/debuild-base/nginx-1.24.0=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I /ngx_brotli/deps/brotli/c/include -I objs -I src/http -I src/http/modules -I src/http/v2 -I src/mail -I src/stream \
	-o objs/addon/enc/encode.o \
	/ngx_brotli/deps/brotli/c/enc/encode.c
/ngx_brotli/deps/brotli/c/enc/encode.c:1473:20: error: argument 5 of type ‘const uint8_t *’ {aka ‘const unsigned char *’} declared as a pointer [-Werror=vla-parameter]
 1473 |     const uint8_t* input_buffer, size_t* encoded_size,
      |     ~~~~~~~~~~~~~~~^~~~~~~~~~~~
In file included from /ngx_brotli/deps/brotli/c/enc/encode.c:9:
/ngx_brotli/deps/brotli/c/include/brotli/encode.h:314:19: note: previously declared as a variable length array ‘const uint8_t[*encoded_size]’ {aka ‘const unsigned char[*encoded_size]’}
  314 |     const uint8_t input_buffer[BROTLI_ARRAY_PARAM(input_size)],
      |     ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/ngx_brotli/deps/brotli/c/enc/encode.c:1474:14: error: argument 7 of type ‘uint8_t *’ {aka ‘unsigned char *’} declared as a pointer [-Werror=vla-parameter]
 1474 |     uint8_t* encoded_buffer) {
      |     ~~~~~~~~~^~~~~~~~~~~~~~
In file included from /ngx_brotli/deps/brotli/c/enc/encode.c:9:
/ngx_brotli/deps/brotli/c/include/brotli/encode.h:316:13: note: previously declared as a variable length array ‘uint8_t[input_size]’ {aka ‘unsigned char[input_size]’}
  316 |     uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(*encoded_size)]);
      |     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [objs/Makefile:1378: objs/addon/enc/encode.o] Error 1
make[1]: Leaving directory '/nginx-1.24.0'
make: *** [Makefile:16: modules] Error 2

nginx-1.25.2

# ./configure --with-compat --add-dynamic-module=/ngx_brotli
# make modules
...
cc -c -fPIC -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -g -O2 -ffile-prefix-map=/data/builder/debuild/nginx-1.25.2/debian/debuild-base/nginx-1.25.2=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/event/quic -I src/os/unix -I /ngx_brotli/deps/brotli/c/include -I objs -I src/http -I src/http/modules -I src/http/v2 -I src/http/v3 -I src/mail -I src/stream \
	-o objs/addon/enc/encode.o \
	/ngx_brotli/deps/brotli/c/enc/encode.c
/ngx_brotli/deps/brotli/c/enc/encode.c:1473:20: error: argument 5 of type ‘const uint8_t *’ {aka ‘const unsigned char *’} declared as a pointer [-Werror=vla-parameter]
 1473 |     const uint8_t* input_buffer, size_t* encoded_size,
      |     ~~~~~~~~~~~~~~~^~~~~~~~~~~~
In file included from /ngx_brotli/deps/brotli/c/enc/encode.c:9:
/ngx_brotli/deps/brotli/c/include/brotli/encode.h:314:19: note: previously declared as a variable length array ‘const uint8_t[*encoded_size]’ {aka ‘const unsigned char[*encoded_size]’}
  314 |     const uint8_t input_buffer[BROTLI_ARRAY_PARAM(input_size)],
      |     ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/ngx_brotli/deps/brotli/c/enc/encode.c:1474:14: error: argument 7 of type ‘uint8_t *’ {aka ‘unsigned char *’} declared as a pointer [-Werror=vla-parameter]
 1474 |     uint8_t* encoded_buffer) {
      |     ~~~~~~~~~^~~~~~~~~~~~~~
In file included from /ngx_brotli/deps/brotli/c/enc/encode.c:9:
/ngx_brotli/deps/brotli/c/include/brotli/encode.h:316:13: note: previously declared as a variable length array ‘uint8_t[input_size]’ {aka ‘unsigned char[input_size]’}
  316 |     uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(*encoded_size)]);
      |     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [objs/Makefile:2260: objs/addon/enc/encode.o] Error 1
make[1]: Leaving directory '/nginx-1.25.2'
make: *** [Makefile:16: modules] Error 2

@cowsay1
Copy link

cowsay1 commented Aug 17, 2023

No problems here

My script to build and install dynamic modules for debian (bookworm) without docker, using nginx release from github

#!/bin/bash

BUILDROOT="/root/build/nginx_modules"

rm -rf $BUILDROOT && mkdir -p $BUILDROOT

### get brotli

cd $BUILDROOT
git clone --recurse-submodules -j8 https://github.com/google/ngx_brotli
cd $BUILDROOT/ngx_brotli/deps/brotli
mkdir out && cd out
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS="-Ofast -m64 -march=native -mtune=native -flto -funroll-loops -ffunction-sections -fdata-sections -Wl,--gc-sections" -DCMAKE_CXX_FLAGS="-Ofast -m64 -march=native -mtune=native -flto -funroll-loops -ffunction-sections -fdata-sections -Wl,--gc-sections" -DCMAKE_INSTALL_PREFIX=./installed ..
cmake --build . --config Release --target brotlienc

### get nginx latest (mainline)

cd $BUILDROOT
git clone https://github.com/nginx/nginx
cd nginx
NGINX_VERSION=$(git tag -l 'release-*' | sort -V | awk -F- '{print $2}' | tail -n 1)
git checkout release-${NGINX_VERSION}

### configure nginx with modules (if problems try to use params same as 'nginx -V', plus added dynamic modules)

./auto/configure --with-compat --add-dynamic-module=$BUILDROOT/ngx_brotli

### make modules only

make modules

### install modules

mkdir -p /usr/lib/nginx/modules
cp ./objs/*.so /usr/lib/nginx/modules/
chmod 644 /usr/lib/nginx/modules/*

rm -rf $BUILDROOT

(upd: fixed for lastest brotli cmake submodule)

@kapouer
Copy link

kapouer commented Aug 17, 2023

@lifeofguenter
Copy link
Author

Resolved with the latest README.md updates.

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

5 participants