yaoweibin / nginx_tcp_proxy_module

add the feature of tcp proxy with nginx, with health check and status monitor
http://yaoweibin.github.com/nginx_tcp_proxy_module
1.65k stars 365 forks source link

compile failed.how to resolve it? #179

Open imgoby opened 2 years ago

imgoby commented 2 years ago

17 66.92 -o objs/addon/parsers/http_request_parser.o \

1693#17 66.92 modules/nginx_tcp_proxy_module/parsers/http_request_parser.c 1694#17 66.95 http_request_parser.c: In function 'http_request_parser_execute': 1695#17 66.95 http_request_parser.rl:29:5: error: this statement may fall through [-Werror=implicit-fallthrough=] 1696#17 66.95 http_request_parser.rl:31:1: note: here 1697#17 66.95 http_request_parser.rl:46:5: error: this statement may fall through [-Werror=implicit-fallthrough=] 1698#17 66.95 http_request_parser.rl:48:1: note: here 1699#17 66.95 http_request_parser.rl:29:5: error: this statement may fall through [-Werror=implicit-fallthrough=] 1700#17 66.95 http_request_parser.rl:31:1: note: here 1701#17 66.95 http_request_parser.rl:50:5: error: this statement may fall through [-Werror=implicit-fallthrough=] 1702#17 66.95 http_request_parser.rl:52:1: note: here 1703#17 66.95 http_request_parser.rl:29:5: error: this statement may fall through [-Werror=implicit-fallthrough=] 1704#17 66.95 http_request_parser.rl:31:1: note: here 1705#17 66.95 http_request_parser.c:241:5: error: this statement may fall through [-Werror=implicit-fallthrough=] 1706#17 66.95 http_request_parser.c:243:1: note: here 1707#17 66.95 http_request_parser.c:248:5: error: this statement may fall through [-Werror=implicit-fallthrough=] 1708#17 66.95 http_request_parser.c:250:1: note: here 1709#17 66.95 http_request_parser.c:255:5: error: this statement may fall through [-Werror=implicit-fallthrough=] 1710#17 66.95 http_request_parser.c:257:1: note: here

yaoweibin commented 2 years ago

It looks like it's broken since nginx-1.20.2, they change a lot of SSL functions. Let me see how to solve it.

ivan100-ivoop commented 2 years ago

/root/nginx_tcp_proxy_module/parsers/http_request_parser.c http_request_parser.c: In function ‘http_request_parser_execute’: http_request_parser.rl:29:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.rl:31:1: note: here http_request_parser.rl:46:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.rl:48:1: note: here http_request_parser.rl:29:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.rl:31:1: note: here http_request_parser.rl:50:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.rl:52:1: note: here http_request_parser.rl:29:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.rl:31:1: note: here http_request_parser.c:241:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:243:1: note: here http_request_parser.c:248:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:250:1: note: here http_request_parser.c:255:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:257:1: note: here http_request_parser.c:262:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:264:1: note: here http_request_parser.c:269:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:271:1: note: here http_request_parser.c:278:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:280:1: note: here http_request_parser.c:285:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:287:1: note: here http_request_parser.rl:42:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.rl:44:1: note: here http_request_parser.c:327:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:329:1: note: here http_request_parser.c:355:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:357:1: note: here http_request_parser.rl:32:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.rl:34:1: note: here http_request_parser.rl:37:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.rl:39:1: note: here http_request_parser.rl:37:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.rl:39:1: note: here http_request_parser.rl:50:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.rl:52:1: note: here http_request_parser.rl:29:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.rl:31:1: note: here http_request_parser.rl:29:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.rl:31:1: note: here http_request_parser.c:545:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:547:1: note: here http_request_parser.rl:29:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.rl:31:1: note: here http_request_parser.rl:29:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.rl:31:1: note: here http_request_parser.c:604:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:606:1: note: here http_request_parser.c:617:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:619:1: note: here http_request_parser.rl:29:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.rl:31:1: note: here http_request_parser.c:653:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:655:1: note: here http_request_parser.c:666:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:668:1: note: here http_request_parser.rl:70:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.rl:72:1: note: here http_request_parser.c:704:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:706:1: note: here http_request_parser.c:717:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:719:1: note: here http_request_parser.rl:70:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.rl:72:1: note: here http_request_parser.rl:56:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.rl:58:1: note: here http_request_parser.rl:56:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.rl:58:1: note: here http_request_parser.c:793:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:795:1: note: here http_request_parser.c:806:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:808:1: note: here http_request_parser.c:824:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:826:1: note: here http_request_parser.c:842:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:844:1: note: here http_request_parser.c:860:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:862:1: note: here http_request_parser.c:878:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:880:1: note: here http_request_parser.c:896:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:898:1: note: here http_request_parser.c:914:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:916:1: note: here http_request_parser.c:932:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:934:1: note: here http_request_parser.c:950:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:952:1: note: here http_request_parser.c:968:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:970:1: note: here http_request_parser.c:986:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:988:1: note: here http_request_parser.c:1004:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:1006:1: note: here http_request_parser.c:1022:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:1024:1: note: here http_request_parser.c:1040:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:1042:1: note: here http_request_parser.c:1058:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:1060:1: note: here http_request_parser.c:1076:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:1078:1: note: here http_request_parser.c:1094:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:1096:1: note: here http_request_parser.c:1112:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:1114:1: note: here http_request_parser.c:1130:5: error: this statement may fall through [-Werror=implicit-fallthrough=] http_request_parser.c:1132:1: note: here cc1: all warnings being treated as errors make[1]: [objs/Makefile:1342: objs/addon/parsers/http_request_parser.o] Error 1 make[1]: Leaving directory '/root/nginx-1.20.2' make: [Makefile:10: build] Error 2

joejordan commented 11 months ago

Getting similar errors with all recent nginx versions I've tried, 1.24, 1.22, 1.20, and 1.18, building on AlmaLinux 8.

Old server had make version 3.82. New server has make version 4.2.1. I believe the compile errors in the original post might be related to newer versions of make.

If I set an environment variable to export CFLAGS="-Wno-error=implicit-fallthrough" then I am able to get further, but the build still stops with the following error:

In file included from src/event/ngx_event_openssl.h:17,
                 from src/core/ngx_core.h:84,
                 from /root/nginx/nginx_tcp_proxy_module-master/modules/ngx_tcp_ssl_module.c:3:
/root/nginx/nginx_tcp_proxy_module-master/modules/ngx_tcp_ssl_module.c: In function 'ngx_tcp_ssl_merge_srv_conf':
/root/nginx/nginx_tcp_proxy_module-master/modules/ngx_tcp_ssl_module.c:389:49: error: 'ngx_ssl_rsa512_key_callback' undeclared (first use in this function); did you mean 'ngx_tcp_ssl_verify_callback'?
     SSL_CTX_set_tmp_rsa_callback(conf->ssl.ctx, ngx_ssl_rsa512_key_callback);
                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/nginx/nginx_tcp_proxy_module-master/modules/ngx_tcp_ssl_module.c:389:49: note: each undeclared identifier is reported only once for each function it appears in
make[1]: *** [objs/addon/modules/ngx_tcp_ssl_module.o] Error 1
make[1]: Leaving directory `/root/nginx/nginx-1.20.2'
make: *** [build] Error 2

ChatGPT seems to think that it's related to an incompatible version of openssl. Interestingly on my old server I had 1.0.2k-fips 26 Jan 2017 installed. New server has 1.1.1k FIPS 25 Mar 2021

Any help with these issues @yaoweibin ?