slact / nchan

Fast, horizontally scalable, multiprocess pub/sub queuing server and proxy for HTTP, long-polling, Websockets and EventSource (SSE), powered by Nginx.
https://nchan.io/
Other
3.01k stars 292 forks source link

Recent nginx changes cause build errors #633

Closed phillipseamore closed 2 years ago

phillipseamore commented 2 years ago

It seems that new changes to nginx master cause build errors with nchan.

Most likely it's related to "Core: made the ngx_sendmsg() function non-static." https://github.com/nginx/nginx/commit/c67400316626a7375b15dc3068fa8c291e3838d9

Build error:

In file included from src/event/ngx_event.h:526,
                 from src/http/ngx_http_upstream.h:14,
                 from src/http/ngx_http.h:34,
                 from /usr/src/nginx_modules/nchan/src/nchan_module.h:17,
                 from /usr/src/nginx_modules/nchan/src/util/hdr_histogram.c:17:
src/event/ngx_event_udp.h:38:27: error: field ‘pkt6’ has incomplete type
   38 |     struct in6_pktinfo    pkt6;
      |                           ^~~~

There is an open ticket with nginx about this https://trac.nginx.org/nginx/ticket/2312

slact commented 2 years ago

I can't reproduce this. Can you show me your configure and build output when building Nchan without other 3rd party modules?

plinss commented 2 years ago

I just ran into the same problem. And I can confirm that #634 does fix the issue. My configure and build output (of the failed build) follows (I did have other modules installed, basically the standard Debian build):

$ auto/configure --with-cc-opt="-g -O2 -fdebug-prefix-map=/build/nginx-1.21.6=. -fstack-protector-strong -Wformat -Werror=format-security -Wno-error=implicit-fallthrough -Wno-error=date-time -fPIC -Wdate-time -D_FORTIFY_SOURCE=2" --with-ld-opt='-Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --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/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-compat --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_flv_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_mp4_module --with-http_perl_module=dynamic --with-http_random_index_module --with-http_secure_link_module --with-http_sub_module --with-http_xslt_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-stream=dynamic --with-stream_geoip_module=dynamic --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --add-dynamic-module=/build/nginx-1.21.6/debian/modules/http-auth-pam --add-dynamic-module=/build/nginx-1.21.6/debian/modules/http-brotli --add-dynamic-module=/build/nginx-1.21.6/debian/modules/http-cache-purge --add-dynamic-module=/build/nginx-1.21.6/debian/modules/http-dav-ext --add-dynamic-module=/build/nginx-1.21.6/debian/modules/http-echo --add-dynamic-module=/build/nginx-1.21.6/debian/modules/http-fancyindex --add-dynamic-module=/build/nginx-1.21.6/debian/modules/http-geoip2 --add-dynamic-module=/build/nginx-1.21.6/debian/modules/http-headers-more-filter --add-dynamic-module=/build/nginx-1.21.6/debian/modules/http-ndk --add-dynamic-module=/build/nginx-1.21.6/debian/modules/http-subs-filter --add-dynamic-module=/build/nginx-1.21.6/debian/modules/http-uploadprogress --add-dynamic-module=/build/nginx-1.21.6/debian/modules/http-upstream-fair --add-dynamic-module=/build/nginx-1.21.6/debian/modules/nchan --add-dynamic-module=/build/nginx-1.21.6/debian/modules/ssl-ct --add-dynamic-module=/build/nginx-1.21.6/debian/modules/rtmp
checking for OS
 + Linux 5.10.0-13-amd64 x86_64
checking for C compiler ... found
 + using GNU C compiler
 + gcc version: 10.2.1 20210110 (Debian 10.2.1-6) 
checking for gcc -pipe switch ... found
checking for --with-ld-opt="-Wl,-z,relro -Wl,-z,now -fPIC" ... found
checking for -Wl,-E switch ... found
checking for gcc builtin atomic operations ... found
checking for C99 variadic macros ... found
checking for gcc variadic macros ... found
checking for gcc builtin 64 bit byteswap ... found
checking for unistd.h ... found
checking for inttypes.h ... found
checking for limits.h ... found
checking for sys/filio.h ... not found
checking for sys/param.h ... found
checking for sys/mount.h ... found
checking for sys/statvfs.h ... found
checking for crypt.h ... found
checking for Linux specific features
checking for epoll ... found
checking for EPOLLRDHUP ... found
checking for EPOLLEXCLUSIVE ... found
checking for eventfd() ... found
checking for O_PATH ... found
checking for sendfile() ... found
checking for sendfile64() ... found
checking for sys/prctl.h ... found
checking for prctl(PR_SET_DUMPABLE) ... found
checking for prctl(PR_SET_KEEPCAPS) ... found
checking for capabilities ... found
checking for crypt_r() ... found
checking for sys/vfs.h ... found
checking for nobody group ... not found
checking for nogroup group ... found
checking for poll() ... found
checking for /dev/poll ... not found
checking for kqueue ... not found
checking for crypt() ... not found
checking for crypt() in libcrypt ... found
checking for F_READAHEAD ... not found
checking for posix_fadvise() ... found
checking for O_DIRECT ... found
checking for F_NOCACHE ... not found
checking for directio() ... not found
checking for statfs() ... found
checking for statvfs() ... found
checking for dlopen() ... not found
checking for dlopen() in libdl ... found
checking for sched_yield() ... found
checking for sched_setaffinity() ... found
checking for SO_SETFIB ... not found
checking for SO_REUSEPORT ... found
checking for SO_ACCEPTFILTER ... not found
checking for SO_BINDANY ... not found
checking for IP_TRANSPARENT ... found
checking for IP_BINDANY ... not found
checking for IP_BIND_ADDRESS_NO_PORT ... found
checking for IP_RECVDSTADDR ... not found
checking for IP_SENDSRCADDR ... not found
checking for IP_PKTINFO ... found
checking for IPV6_RECVPKTINFO ... found
checking for TCP_DEFER_ACCEPT ... found
checking for TCP_KEEPIDLE ... found
checking for TCP_FASTOPEN ... found
checking for TCP_INFO ... found
checking for accept4() ... found
checking for int size ... 4 bytes
checking for long size ... 8 bytes
checking for long long size ... 8 bytes
checking for void * size ... 8 bytes
checking for uint32_t ... found
checking for uint64_t ... found
checking for sig_atomic_t ... found
checking for sig_atomic_t size ... 4 bytes
checking for socklen_t ... found
checking for in_addr_t ... found
checking for in_port_t ... found
checking for rlim_t ... found
checking for uintptr_t ... uintptr_t found
checking for system byte ordering ... little endian
checking for size_t size ... 8 bytes
checking for off_t size ... 8 bytes
checking for time_t size ... 8 bytes
checking for AF_INET6 ... found
checking for setproctitle() ... not found
checking for pread() ... found
checking for pwrite() ... found
checking for pwritev() ... found
checking for strerrordesc_np() ... not found
checking for sys_nerr ... found
checking for localtime_r() ... found
checking for clock_gettime(CLOCK_MONOTONIC) ... found
checking for posix_memalign() ... found
checking for memalign() ... found
checking for mmap(MAP_ANON|MAP_SHARED) ... found
checking for mmap("/dev/zero", MAP_SHARED) ... found
checking for System V shared memory ... found
checking for POSIX semaphores ... not found
checking for POSIX semaphores in libpthread ... found
checking for struct msghdr.msg_control ... found
checking for ioctl(FIONBIO) ... found
checking for ioctl(FIONREAD) ... found
checking for struct tm.tm_gmtoff ... found
checking for struct dirent.d_namlen ... not found
checking for struct dirent.d_type ... found
checking for sysconf(_SC_NPROCESSORS_ONLN) ... found
checking for sysconf(_SC_LEVEL1_DCACHE_LINESIZE) ... found
checking for openat(), fstatat() ... found
checking for getaddrinfo() ... found
configuring additional dynamic modules
adding module in /build/nginx-1.21.6/debian/modules/http-auth-pam
 + ngx_http_auth_pam_module was configured
adding module in /build/nginx-1.21.6/debian/modules/http-brotli
 + ngx_brotli was configured
adding module in /build/nginx-1.21.6/debian/modules/http-cache-purge
 + ngx_http_cache_purge_module was configured
adding module in /build/nginx-1.21.6/debian/modules/http-dav-ext
 + ngx_http_dav_ext_module was configured
adding module in /build/nginx-1.21.6/debian/modules/http-echo
 + ngx_http_echo_module was configured
adding module in /build/nginx-1.21.6/debian/modules/http-fancyindex
 + ngx_http_fancyindex_module was configured
adding module in /build/nginx-1.21.6/debian/modules/http-geoip2
checking for MaxmindDB library ... found
 + ngx_geoip2_module was configured
adding module in /build/nginx-1.21.6/debian/modules/http-headers-more-filter
 + ngx_http_headers_more_filter_module was configured
adding module in /build/nginx-1.21.6/debian/modules/http-ndk
 + ngx_devel_kit was configured
adding module in /build/nginx-1.21.6/debian/modules/http-subs-filter
 + ngx_http_subs_filter_module was configured
adding module in /build/nginx-1.21.6/debian/modules/http-uploadprogress
 + ngx_http_uploadprogress_module was configured
adding module in /build/nginx-1.21.6/debian/modules/http-upstream-fair
 + ngx_http_upstream_fair_module was configured
adding module in /build/nginx-1.21.6/debian/modules/nchan
checking for hiredis with stored sockaddr ... not found
checking for math lib ... found
checking for memrchr() ... found
 + ngx_nchan_module was configured
adding module in /build/nginx-1.21.6/debian/modules/ssl-ct
 + ngx_ssl_ct_module was configured
adding module in /build/nginx-1.21.6/debian/modules/rtmp
 + ngx_rtmp_module was configured
checking for PCRE2 library ... not found
checking for PCRE library ... found
checking for PCRE JIT support ... found
checking for OpenSSL library ... found
checking for zlib library ... found
checking for libxslt ... found
checking for libexslt ... found
checking for GD library ... found
checking for GD WebP support ... found
checking for perl
 + perl version: This is perl 5, version 32, subversion 1 (v5.32.1) built for x86_64-linux-gnu-thread-multi
 + perl interpreter multiplicity found
checking for GeoIP library ... found
checking for GeoIP IPv6 support ... found
creating objs/Makefile
Configuration summary
  + using threads
  + using system PCRE library
  + using system OpenSSL library
  + using system zlib library
  nginx path prefix: "/usr/share/nginx"
  nginx binary file: "/usr/share/nginx/sbin/nginx"
  nginx modules path: "/usr/lib/nginx/modules"
  nginx configuration prefix: "/etc/nginx"
  nginx configuration file: "/etc/nginx/nginx.conf"
  nginx pid file: "/run/nginx.pid"
  nginx error log file: "/var/log/nginx/error.log"
  nginx http access log file: "/var/log/nginx/access.log"
  nginx http client request body temporary files: "/var/lib/nginx/body"
  nginx http proxy temporary files: "/var/lib/nginx/proxy"
  nginx http fastcgi temporary files: "/var/lib/nginx/fastcgi"
  nginx http uwsgi temporary files: "/var/lib/nginx/uwsgi"
  nginx http scgi temporary files: "/var/lib/nginx/scgi"
$ make
make -f objs/Makefile
make[1]: Entering directory '/build/nginx-1.21.6'

...(successful output deleted for brevity)...

cc -c -fPIC -pipe  -O -W -Wno-unused-parameter -Werror -g -g -O2 -fdebug-prefix-map=/build/nginx-1.21.6=. -fstack-protector-strong -Wformat -Werror=format-security -Wno-error=implicit-fallthrough -Wno-error=date-time -fPIC -Wdate-time -D_FORTIFY_SOURCE=2 -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/os/unix -I src/http/modules/perl -I /build/nginx-1.21.6/debian/modules/http-brotli/deps/brotli/c/include -I /build/nginx-1.21.6/debian/modules/http-ndk/objs -I objs/addon/ndk -I /build/nginx-1.21.6/debian/modules/http-ndk/src -I /build/nginx-1.21.6/debian/modules/http-ndk/objs -I objs/addon/ndk -I /build/nginx-1.21.6/debian/modules/nchan/src -I /build/nginx-1.21.6/debian/modules/rtmp -I /usr/include/libxml2 -I objs -I src/http -I src/http/modules -I src/http/v2 -I /build/nginx-1.21.6/debian/modules/http-ndk/src -I src/mail -I src/stream \
    -o objs/addon/redis/rdsstore.o \
    /build/nginx-1.21.6/debian/modules/nchan/src/store/redis/rdsstore.c
/build/nginx-1.21.6/debian/modules/nchan/src/store/redis/rdsstore.c: In function 'redisReplyOk':
/build/nginx-1.21.6/debian/modules/nchan/src/store/redis/rdsstore.c:390:30: error: passing argument 1 of 'nchan_cstr_startswith' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
  390 |     if(nchan_cstr_startswith(str, script_error_start)) {
      |                              ^~~
In file included from /build/nginx-1.21.6/debian/modules/nchan/src/nchan_module.h:31,
                 from /build/nginx-1.21.6/debian/modules/nchan/src/store/redis/rdsstore.c:1:
/build/nginx-1.21.6/debian/modules/nchan/src/util/nchan_util.h:23:33: note: expected 'char *' but argument is of type 'const char *'
   23 | int nchan_cstr_startswith(char *cstr, char *match);
      |                           ~~~~~~^~~~
/build/nginx-1.21.6/debian/modules/nchan/src/store/redis/rdsstore.c:390:35: error: passing argument 2 of 'nchan_cstr_startswith' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
  390 |     if(nchan_cstr_startswith(str, script_error_start)) {
      |                                   ^~~~~~~~~~~~~~~~~~
In file included from /build/nginx-1.21.6/debian/modules/nchan/src/nchan_module.h:31,
                 from /build/nginx-1.21.6/debian/modules/nchan/src/store/redis/rdsstore.c:1:
/build/nginx-1.21.6/debian/modules/nchan/src/util/nchan_util.h:23:45: note: expected 'char *' but argument is of type 'const char *'
   23 | int nchan_cstr_startswith(char *cstr, char *match);
      |                                       ~~~~~~^~~~~
/build/nginx-1.21.6/debian/modules/nchan/src/store/redis/rdsstore.c:394:17: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
  394 |       hash.data = &str[i];
      |                 ^
/build/nginx-1.21.6/debian/modules/nchan/src/store/redis/rdsstore.c:411:35: error: passing argument 1 of 'nchan_cstr_startswith' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
  411 |     else if(nchan_cstr_startswith(str, script_error_start_redis7)) {
      |                                   ^~~
In file included from /build/nginx-1.21.6/debian/modules/nchan/src/nchan_module.h:31,
                 from /build/nginx-1.21.6/debian/modules/nchan/src/store/redis/rdsstore.c:1:
/build/nginx-1.21.6/debian/modules/nchan/src/util/nchan_util.h:23:33: note: expected 'char *' but argument is of type 'const char *'
   23 | int nchan_cstr_startswith(char *cstr, char *match);
      |                           ~~~~~~^~~~
/build/nginx-1.21.6/debian/modules/nchan/src/store/redis/rdsstore.c:411:40: error: passing argument 2 of 'nchan_cstr_startswith' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
  411 |     else if(nchan_cstr_startswith(str, script_error_start_redis7)) {
      |                                        ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /build/nginx-1.21.6/debian/modules/nchan/src/nchan_module.h:31,
                 from /build/nginx-1.21.6/debian/modules/nchan/src/store/redis/rdsstore.c:1:
/build/nginx-1.21.6/debian/modules/nchan/src/util/nchan_util.h:23:45: note: expected 'char *' but argument is of type 'const char *'
   23 | int nchan_cstr_startswith(char *cstr, char *match);
      |                                       ~~~~~~^~~~~
/build/nginx-1.21.6/debian/modules/nchan/src/store/redis/rdsstore.c:415:19: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
  415 |       char *cur = str, *prev=NULL;
      |                   ^~~
/build/nginx-1.21.6/debian/modules/nchan/src/store/redis/rdsstore.c:429:19: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
  429 |       errmsg.data = &str[16];
      |                   ^
In file included from src/core/ngx_core.h:60,
                 from src/http/ngx_http.h:13,
                 from /build/nginx-1.21.6/debian/modules/nchan/src/nchan_module.h:17,
                 from /build/nginx-1.21.6/debian/modules/nchan/src/store/redis/rdsstore.c:1:
/build/nginx-1.21.6/debian/modules/nchan/src/store/redis/rdsstore.c: In function 'ensure_chanhead_pubsub_subscribed_if_needed':
/build/nginx-1.21.6/debian/modules/nchan/src/store/redis/rdsstore.c:1361:49: error: 'namespace' undeclared (first use in this function)
 1361 |     DBG("SUBSCRIBING to %V{channel:%V}:pubsub", namespace, &ch->id);
      |                                                 ^~~~~~~~~
src/core/ngx_log.h:86:67: note: in definition of macro 'ngx_log_error'
   86 |     if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
      |                                                                   ^~~~~~~~~~~
/build/nginx-1.21.6/debian/modules/nchan/src/store/redis/rdsstore.c:1361:5: note: in expansion of macro 'DBG'
 1361 |     DBG("SUBSCRIBING to %V{channel:%V}:pubsub", namespace, &ch->id);
      |     ^~~
/build/nginx-1.21.6/debian/modules/nchan/src/store/redis/rdsstore.c:1361:49: note: each undeclared identifier is reported only once for each function it appears in
 1361 |     DBG("SUBSCRIBING to %V{channel:%V}:pubsub", namespace, &ch->id);
      |                                                 ^~~~~~~~~
src/core/ngx_log.h:86:67: note: in definition of macro 'ngx_log_error'
   86 |     if ((log)->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
      |                                                                   ^~~~~~~~~~~
/build/nginx-1.21.6/debian/modules/nchan/src/store/redis/rdsstore.c:1361:5: note: in expansion of macro 'DBG'
 1361 |     DBG("SUBSCRIBING to %V{channel:%V}:pubsub", namespace, &ch->id);
      |     ^~~
cc1: all warnings being treated as errors
make[1]: *** [objs/Makefile:2905: objs/addon/redis/rdsstore.o] Error 1
make[1]: Leaving directory '/build/nginx-1.21.6'
make: *** [Makefile:10: build] Error 2
hobson42 commented 2 years ago

I have the same problem, compiling nginx -1.20.1. This is my call to configure

#!/usr/bin/bash
./configure --prefix=/etc/nginx \
  --sbin-path=/usr/sbin/nginx \
  --conf-path=/etc/nginx/nginx.conf \
  --error-log-path=/var/log/nginx/error.log \
  --http-log-path=/var/log/nginx/access.log \
  --pid-path=/var/run/nginx.pid \
  --lock-path=/var/run/nginx.lock \
  --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-http_ssl_module \
  --with-openssl=../openssl-3.0.3 \
  --with-http_realip_module \
  --with-http_addition_module \
  --with-http_sub_module \
  --with-http_dav_module \
  --with-http_flv_module \
  --with-http_mp4_module \
  --with-http_gunzip_module \
  --with-http_gzip_static_module \
  --with-http_random_index_module \
  --with-http_secure_link_module \
  --with-http_stub_status_module \
  --with-http_auth_request_module \
  --with-threads \
  --with-stream \
  --with-stream_ssl_module \
  --with-http_slice_module \
  --with-mail \
  --with-mail_ssl_module \
  --with-file-aio \
  --with-http_v2_module \
  --with-pcre=../pcre-8.45 \
  --with-zlib=../zlib-1.2.12 \
  --add-module=../nchan-1.2.15