TeslaGov / ngx-http-auth-jwt-module

Secure your NGINX locations with JWT
MIT License
308 stars 118 forks source link

Error while building inside container "all warnings being treated as errors" #125

Open artshade opened 3 months ago

artshade commented 3 months ago

Dear Developers,

Thank you very much for the awesome module!

I am sorry, but apparently am getting an error when trying to build inside container.

Dockerfile Excerpt

FROM base AS initial

RUN \
    apt-get update && \
    apt-get full-upgrade -y;

# General Dependencies
# --------------------------------

RUN apt-get update && \
    apt-get install -y \
        ca-certificates \
        openssh-client \
        curl \
        wget \
        git \
        unzip \
        libxml2 \
        libxslt1-dev \
        libpcre3 \
        libpcre3-dev \
        zlib1g \
        zlib1g-dev \
        openssl \
        libssl-dev \
        libtool \
        automake \
        gcc \
        g++ \
        make && \
    apt-get autoremove --purge -y && \
    apt-get clean && \
    rm -rf -- '/var/lib/apt/lists/'* '/tmp/'* '/var/tmp/'* '/usr/share/doc/'* '/var/cache/apt';

# Nginx Source
# --------------------------------

FROM initial AS build

RUN \
    mkdir -pv -- '/tmp/nginx-src' && \
    cd -- '/tmp/nginx-src' && \
    wget -- "https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" && \
    tar -C '/usr/src' -xvzf "nginx-${NGINX_VERSION}.tar.gz" && \
    mv -v -- '/usr/src/nginx-'* '/usr/src/nginx' && \
    rm -rfv -- '/tmp/nginx-src';

# Nginx Module Sources
# --------------------------------

RUN \
    apt-get update && \
    apt-get install -y -- \
        libjansson-dev \
        libjwt-dev && \
    apt-get autoremove --purge -y && \
    apt-get clean && \
    rm -rf -- '/var/lib/apt/lists/'* '/tmp/'* '/var/tmp/'* '/usr/share/doc/'* '/var/cache/apt';

RUN \
    cd -- '/usr/src/nginx-modules-src' && \
    git clone -- 'https://github.com/TeslaGov/ngx-http-auth-jwt-module';

# Nginx Build
# --------------------------------

WORKDIR "/usr/src/nginx"

RUN \
    NGINX_ARGS="$( nginx -V 2>&1 | sed -ne 's/^.*arguments:\s\+//p'; )" \
        ./configure \
            --with-compat \
            --with-http_ssl_module \
            --add-module='/usr/src/nginx-modules-src/ngx-http-auth-jwt-module' \
            $NGINX_ARGS;

RUN \
    make && \
    make install;

Error

...
70.35   -o objs/src/http/modules/ngx_http_uwsgi_module.o \
70.35   src/http/modules/ngx_http_uwsgi_module.c
71.25 cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -I src/core -I src/event -I src/event/modules -I src/event/quic -I src/os/unix -I objs -I src/http -I src/http/modules \
71.25   -o objs/src/http/modules/ngx_http_scgi_module.o \
71.25   src/http/modules/ngx_http_scgi_module.c
72.05 cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -I src/core -I src/event -I src/event/modules -I src/event/quic -I src/os/unix -I objs -I src/http -I src/http/modules \
72.05   -o objs/src/http/modules/ngx_http_memcached_module.o \
72.05   src/http/modules/ngx_http_memcached_module.c
72.73 cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -I src/core -I src/event -I src/event/modules -I src/event/quic -I src/os/unix -I objs -I src/http -I src/http/modules \
72.73   -o objs/src/http/modules/ngx_http_empty_gif_module.o \
72.73   src/http/modules/ngx_http_empty_gif_module.c
73.19 cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -I src/core -I src/event -I src/event/modules -I src/event/quic -I src/os/unix -I objs -I src/http -I src/http/modules \
73.19   -o objs/src/http/modules/ngx_http_browser_module.o \
73.19   src/http/modules/ngx_http_browser_module.c
73.69 cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -I src/core -I src/event -I src/event/modules -I src/event/quic -I src/os/unix -I objs -I src/http -I src/http/modules \
73.69   -o objs/src/http/modules/ngx_http_upstream_hash_module.o \
73.69   src/http/modules/ngx_http_upstream_hash_module.c
74.30 cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -I src/core -I src/event -I src/event/modules -I src/event/quic -I src/os/unix -I objs -I src/http -I src/http/modules \
74.30   -o objs/src/http/modules/ngx_http_upstream_ip_hash_module.o \
74.30   src/http/modules/ngx_http_upstream_ip_hash_module.c
74.76 cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -I src/core -I src/event -I src/event/modules -I src/event/quic -I src/os/unix -I objs -I src/http -I src/http/modules \
74.76   -o objs/src/http/modules/ngx_http_upstream_least_conn_module.o \
74.76   src/http/modules/ngx_http_upstream_least_conn_module.c
75.20 cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -I src/core -I src/event -I src/event/modules -I src/event/quic -I src/os/unix -I objs -I src/http -I src/http/modules \
75.20   -o objs/src/http/modules/ngx_http_upstream_random_module.o \
75.20   src/http/modules/ngx_http_upstream_random_module.c
75.63 cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -I src/core -I src/event -I src/event/modules -I src/event/quic -I src/os/unix -I objs -I src/http -I src/http/modules \
75.63   -o objs/src/http/modules/ngx_http_upstream_keepalive_module.o \
75.63   src/http/modules/ngx_http_upstream_keepalive_module.c
76.08 cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -I src/core -I src/event -I src/event/modules -I src/event/quic -I src/os/unix -I objs -I src/http -I src/http/modules \
76.08   -o objs/src/http/modules/ngx_http_upstream_zone_module.o \
76.08   src/http/modules/ngx_http_upstream_zone_module.c
76.49 cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g   -I src/core -I src/event -I src/event/modules -I src/event/quic -I src/os/unix -I objs -I src/http -I src/http/modules \
76.49   -o objs/addon/src/arrays.o \
76.49   /usr/src/nginx-modules-src/ngx-http-auth-jwt-module/src/arrays.c
76.82 cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g   -I src/core -I src/event -I src/event/modules -I src/event/quic -I src/os/unix -I objs -I src/http -I src/http/modules \
76.82   -o objs/addon/src/ngx_http_auth_jwt_binary_converters.o \
76.82   /usr/src/nginx-modules-src/ngx-http-auth-jwt-module/src/ngx_http_auth_jwt_binary_converters.c
77.19 cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g   -I src/core -I src/event -I src/event/modules -I src/event/quic -I src/os/unix -I objs -I src/http -I src/http/modules \
77.19   -o objs/addon/src/ngx_http_auth_jwt_header_processing.o \
77.19   /usr/src/nginx-modules-src/ngx-http-auth-jwt-module/src/ngx_http_auth_jwt_header_processing.c
77.61 cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g   -I src/core -I src/event -I src/event/modules -I src/event/quic -I src/os/unix -I objs -I src/http -I src/http/modules \
77.61   -o objs/addon/src/ngx_http_auth_jwt_string.o \
77.61   /usr/src/nginx-modules-src/ngx-http-auth-jwt-module/src/ngx_http_auth_jwt_string.c
77.97 cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g   -I src/core -I src/event -I src/event/modules -I src/event/quic -I src/os/unix -I objs -I src/http -I src/http/modules \
77.97   -o objs/addon/src/ngx_http_auth_jwt_module.o \
77.97   /usr/src/nginx-modules-src/ngx-http-auth-jwt-module/src/ngx_http_auth_jwt_module.c
78.30 /usr/src/nginx-modules-src/ngx-http-auth-jwt-module/src/ngx_http_auth_jwt_module.c: In function 'get_jwt':
78.30 /usr/src/nginx-modules-src/ngx-http-auth-jwt-module/src/ngx_http_auth_jwt_module.c:657:58: error: 'ngx_http_headers_in_t' has no member named 'cookies'; did you mean 'cookie'?
78.30   657 |     if (ngx_http_parse_multi_header_lines(&r->headers_in.cookies, &jwt_location, &jwtCookieVal) != NGX_DECLINED)
78.30       |                                                          ^~~~~~~
78.30       |                                                          cookie
78.30 /usr/src/nginx-modules-src/ngx-http-auth-jwt-module/src/ngx_http_auth_jwt_module.c:657:67: error: passing argument 2 of 'ngx_http_parse_multi_header_lines' from incompatible pointer type [-Werror=incompatible-pointer-types]
78.30   657 |     if (ngx_http_parse_multi_header_lines(&r->headers_in.cookies, &jwt_location, &jwtCookieVal) != NGX_DECLINED)
78.30       |                                                                   ^~~~~~~~~~~~~
78.30       |                                                                   |
78.30       |                                                                   ngx_str_t *
78.30 In file included from /usr/src/nginx-modules-src/ngx-http-auth-jwt-module/src/ngx_http_auth_jwt_module.c:12:
78.30 src/http/ngx_http.h:112:22: note: expected 'ngx_table_elt_t *' {aka 'struct ngx_table_elt_s *'} but argument is of type 'ngx_str_t *'
78.30   112 |     ngx_table_elt_t *headers, ngx_str_t *name, ngx_str_t *value);
78.30       |     ~~~~~~~~~~~~~~~~~^~~~~~~
78.30 /usr/src/nginx-modules-src/ngx-http-auth-jwt-module/src/ngx_http_auth_jwt_module.c:657:9: error: too few arguments to function 'ngx_http_parse_multi_header_lines'
78.30   657 |     if (ngx_http_parse_multi_header_lines(&r->headers_in.cookies, &jwt_location, &jwtCookieVal) != NGX_DECLINED)
78.30       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
78.30 src/http/ngx_http.h:111:18: note: declared here
78.30   111 | ngx_table_elt_t *ngx_http_parse_multi_header_lines(ngx_http_request_t *r,
78.30       |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
78.31 cc1: all warnings being treated as errors
78.32 make[1]: *** [objs/Makefile:1281: objs/addon/src/ngx_http_auth_jwt_module.o] Error 1
78.32 make[1]: Leaving directory '/usr/src/nginx'
78.32 make: *** [Makefile:10: build] Error 2

What might it be?

Best and kind regards