TeslaGov / ngx-http-auth-jwt-module

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

Build failed for nginx v1.25.5 debian bookworm on wsl #127

Open slushpuppy opened 2 months ago

slushpuppy commented 2 months ago
/root/nginx//modules/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’
  657 |     if (ngx_http_parse_multi_header_lines(&r->headers_in.cookies, &jwt_location, &jwtCookieVal) != NGX_DECLINED)
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/http/ngx_http.h:111:18: note: declared here
  111 | ngx_table_elt_t *ngx_http_parse_multi_header_lines(ngx_http_request_t *r,
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[1]: *** [objs/Makefile:2113: objs/addon/src/ngx_http_auth_jwt_module.o] Error 1
make[1]: Leaving directory '/root/nginx/nginx-1.25.5'
make: *** [Makefile:16: modules] Error 2

Hi, build failed for nginx mainline build on debian wsl 1, header incompatibility

branch tag: 2.1.0-1

Thanks

JoshMcCullough commented 2 months ago

Hello. Can you please show how you're building the module?

sokratis1988 commented 1 month ago

@JoshMcCullough

Same issue here. OS: Ubuntu Linux 20.04 LTS Nginx version: 1.24.0 | 1.26.0

Configure command:

./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/run/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=www-data --group=www-data --with-file-aio --with-compat --add-dynamic-module=../ngx-http-auth-jwt-module-2.1.0

Error:


objs/src/http/modules/ngx_http_upstream_hash_module.o \
objs/src/http/modules/ngx_http_upstream_ip_hash_module.o \
objs/src/http/modules/ngx_http_upstream_least_conn_module.o \
objs/src/http/modules/ngx_http_upstream_random_module.o \
objs/src/http/modules/ngx_http_upstream_keepalive_module.o \
objs/src/http/modules/ngx_http_upstream_zone_module.o \
objs/ngx_modules.o \
-ldl -lpthread -lcrypt -lpcre -lz \
-Wl,-E
cc -c -fPIC -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 \
    -o objs/addon/src/arrays.o \
    ../ngx-http-auth-jwt-module-2.1.0/src/arrays.c
cc -c -fPIC -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 \
    -o objs/addon/src/ngx_http_auth_jwt_binary_converters.o \
    ../ngx-http-auth-jwt-module-2.1.0/src/ngx_http_auth_jwt_binary_converters.c
cc -c -fPIC -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 \
    -o objs/addon/src/ngx_http_auth_jwt_header_processing.o \
    ../ngx-http-auth-jwt-module-2.1.0/src/ngx_http_auth_jwt_header_processing.c
cc -c -fPIC -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 \
    -o objs/addon/src/ngx_http_auth_jwt_string.o \
    ../ngx-http-auth-jwt-module-2.1.0/src/ngx_http_auth_jwt_string.c
cc -c -fPIC -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 \
    -o objs/addon/src/ngx_http_auth_jwt_module.o \
    ../ngx-http-auth-jwt-module-2.1.0/src/ngx_http_auth_jwt_module.c
../ngx-http-auth-jwt-module-2.1.0/src/ngx_http_auth_jwt_module.c: In function ‘get_jwt’:
../ngx-http-auth-jwt-module-2.1.0/src/ngx_http_auth_jwt_module.c:657:58: error: ‘ngx_http_headers_in_t’ {aka ‘struct <anonymous>’} has no member named ‘cookies’; did you mean ‘cookie’?
  657 |     if (ngx_http_parse_multi_header_lines(&r->headers_in.cookies, &jwt_location, &jwtCookieVal) != NGX_DECLINED)
      |                                                          ^~~~~~~
      |                                                          cookie
../ngx-http-auth-jwt-module-2.1.0/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]
  657 |     if (ngx_http_parse_multi_header_lines(&r->headers_in.cookies, &jwt_location, &jwtCookieVal) != NGX_DECLINED)
      |                                                                   ^~~~~~~~~~~~~
      |                                                                   |
      |                                                                   ngx_str_t * {aka struct <anonymous> *}
In file included from ../ngx-http-auth-jwt-module-2.1.0/src/ngx_http_auth_jwt_module.c:12:
src/http/ngx_http.h:111:18: note: expected ‘ngx_table_elt_t *’ {aka ‘struct ngx_table_elt_s *’} but argument is of type ‘ngx_str_t *’ {aka ‘struct <anonymous> *’}
  111 | ngx_table_elt_t *ngx_http_parse_multi_header_lines(ngx_http_request_t *r,
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../ngx-http-auth-jwt-module-2.1.0/src/ngx_http_auth_jwt_module.c:657:9: error: too few arguments to function ‘ngx_http_parse_multi_header_lines’
  657 |     if (ngx_http_parse_multi_header_lines(&r->headers_in.cookies, &jwt_location, &jwtCookieVal) != NGX_DECLINED)
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../ngx-http-auth-jwt-module-2.1.0/src/ngx_http_auth_jwt_module.c:12:
src/http/ngx_http.h:111:18: note: declared here
  111 | ngx_table_elt_t *ngx_http_parse_multi_header_lines(ngx_http_request_t *r,
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [objs/Makefile:1278: objs/addon/src/ngx_http_auth_jwt_module.o] Error 1
make[1]: Leaving directory '/tmp/nginx-1.26.0'
make: *** [Makefile:10: build] Error 2
JoshMcCullough commented 1 month ago

If you're doing a custom build, please make sure you have a look at the Dockerfile as some build flags need to be set, see here:

https://github.com/TeslaGov/ngx-http-auth-jwt-module/blob/master/nginx.dockerfile#L36

jameskentTX commented 1 day ago

Same issue here, same error sokratis1988 showed (657, headers_in.cookies). OS: Debian 12.6 Nginx version: 1.27

Without ngx-http-auth-jwt-module build was successful.

./configure --prefix=/opt/nginx --with-openssl=../openssl-3.3.1 --with-compat --add-dynamic-module=../ngx-http-auth-jwt-module --with-http_ssl_module --with-http_stub_status_module
make modules

In ngx-http-auth-jwt-module directory: git checkout 2.1.0

../ngx-http-auth-jwt-module/src/ngx_http_auth_jwt_module.c: In function ‘get_jwt’:
../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’?
  657 |     if (ngx_http_parse_multi_header_lines(&r->headers_in.cookies, &jwt_location, &jwtCookieVal) != NGX_DECLINED)
      |                                                          ^~~~~~~
      |                                                          cookie
../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]
  657 |     if (ngx_http_parse_multi_header_lines(&r->headers_in.cookies, &jwt_location, &jwtCookieVal) != NGX_DECLINED)
      |                                                                   ^~~~~~~~~~~~~
      |                                                                   |
      |                                                                   ngx_str_t *
In file included from ../ngx-http-auth-jwt-module/src/ngx_http_auth_jwt_module.c:12:
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 *’
  112 |     ngx_table_elt_t *headers, ngx_str_t *name, ngx_str_t *value);
      |     ~~~~~~~~~~~~~~~~~^~~~~~~
../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’
  657 |     if (ngx_http_parse_multi_header_lines(&r->headers_in.cookies, &jwt_location, &jwtCookieVal) != NGX_DECLINED)
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/http/ngx_http.h:111:18: note: declared here
  111 | ngx_table_elt_t *ngx_http_parse_multi_header_lines(ngx_http_request_t *r,
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [objs/Makefile:1310: objs/addon/src/ngx_http_auth_jwt_module.o] Error 1