stream-echo-nginx-module
stream-echo-nginx-module copied to clipboard
compile fail
When I build the stream-echo-nginx-module, Complitation failed with the errors as flow,
ngx_stream_echo_module.c:1146:9: 错误:隐式声明函数‘ngx_stream_close_connection [-Werror=implicit-function-declaration] ngx_stream_close_connection(c);
my gcc version is 4.8.5。
My nginx version is 1.15.9。
I read the code carefully, the function ngx_stream_close_connection is static defined in ngx_stream_handler.c,
static void ngx_stream_close_connection(ngx_connection_t *c);
it can not be used externally. I replace ngx_stream_close_connection whit ngx_stream_finalize_session, and complile successfully.
I think ngx_stream_close_connection maybe not static in the old verison of nginx
@WinterChen Will you please create a github pull request for this fix? Many thanks. Not sure if we still want to support older versions of the nginx core. Maybe we could simply drop the support for older nginx versions.
In fact, On the Alpine 3.10, Nginx 1.17.6 have same issues.
Such as:
/usr/src/stream-echo-nginx-module/src/ngx_stream_echo_module.c: In function 'ngx_stream_echo_discarded_request_handler':
/usr/src/stream-echo-nginx-module/src/ngx_stream_echo_module.c:1146:9: error: implicit declaration of function 'ngx_stream_close_connection'; did you mean 'ngx_stream_init_connection'? [-Werror=implicit-function-declaration]
ngx_stream_close_connection(c);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
ngx_stream_init_connection
and
cc1: all warnings being treated as errors
make[1]: *** [objs/Makefile:1824: objs/addon/src/ngx_stream_echo_module.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/usr/src/nginx-1.17.6'
make: *** [Makefile:8: build] Error 2
Fedora 31
with newest master branch from https://github.com/nginx/nginx
(master)
/usr/bin/ld: objs/addon/src/ngx_stream_echo_module.o: in function `ngx_stream_echo_lingering_close_handler':
/opt/source/nginx/../modules/stream-echo-nginx-module//src/ngx_stream_echo_module.c:1564: undefined reference to `ngx_stream_close_connection'
/usr/bin/ld: objs/addon/src/ngx_stream_echo_module.o: in function `ngx_stream_echo_finalize':
/opt/source/nginx/../modules/stream-echo-nginx-module//src/ngx_stream_echo_module.c:1455: undefined reference to `ngx_stream_close_connection'
/usr/bin/ld: objs/addon/src/ngx_stream_echo_module.o: in function `ngx_stream_echo_discarded_request_handler':
/opt/source/nginx/../modules/stream-echo-nginx-module//src/ngx_stream_echo_module.c:1146: undefined reference to `ngx_stream_close_connection'
collect2: error: ld returned 1 exit status
Pull requests welcome. We no longer actively develop this module ourselves but we welcome patches from the community. Thanks.
we are still seeing this issue @agentzh , did this issue got fixed in any pull request ../stream-echo-nginx-module/src/ngx_stream_echo_module.c: In function ‘ngx_stream_echo_discarded_request_handler’: ../stream-echo-nginx-module/src/ngx_stream_echo_module.c:1146:9: error: implicit declaration of function ‘ngx_stream_close_connection’; did you mean ‘ngx_stream_init_connection’? [-Werror=implicit-function-declaration] ngx_stream_close_connection(c);
@WinterChen do u have the pull request for this ?