ADD-SP / ngx_waf

Handy, High performance, ModSecurity compatible Nginx firewall module & 方便、高性能、兼容 ModSecurity 的 Nginx 防火墙模块
https://add-sp.github.io/ngx_waf-docs/
BSD 3-Clause "New" or "Revised" License
1.49k stars 187 forks source link

最新版编译报错 #127

Closed typ431127 closed 1 year ago

typ431127 commented 1 year ago

系统版本: CentOS Linux release 7.3.1611 (Core) 内核版本: 3.10.0-514.26.2.el7.x86_64 nginx版本: nginx-1.20.1 nginx_waf版本: current最新版 git拉取 编译参数:

./configure --prefix=/app/nginx-1.20.1 --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_v2_module --with-openssl=/data/install/openssl-1.0.2l/ --with-cc-opt=-std=gnu99 --add-module=/usr/local/src/ngx_waf --with-debug

错误说明

make阶段报错

    /usr/local/src/ngx_waf/src/ngx_http_waf_module_check.c
cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -std=gnu99 -fstack-protector-strong -Wno-sign-compare  -I src/core -I src/event -I src/event/modules -I src/os/unix -I /data/install/openssl-1.0.2l//.openssl/include -I objs -I src/http -I src/http/modules -I src/http/v2 -I /usr/local/src/ngx_waf/inc -I /usr/local/src/ngx_waf/lib -I /usr/local/modsecurity/include -I /usr/local/src/ngx_waf/lib/uthash/include -I /usr/local/src/nginx-1.20.1/libsodium/include \
    -o objs/addon/src/ngx_http_waf_module_config.o \
    /usr/local/src/ngx_waf/src/ngx_http_waf_module_config.c
In file included from /usr/local/src/ngx_waf/inc/ngx_http_waf_module_type.h:23:0,
                 from /usr/local/src/ngx_waf/inc/ngx_http_waf_module_config.h:22,
                 from /usr/local/src/ngx_waf/src/ngx_http_waf_module_config.c:1:
/usr/local/src/ngx_waf/src/ngx_http_waf_module_config.c: In function ‘ngx_http_waf_captcha_conf’:
/usr/local/src/ngx_waf/inc/ngx_http_waf_module_macro.h:359:33: error: the comparison will always evaluate as ‘false’ for the address of ‘sitekey’ will never be NULL [-Werror=address]
 #define ngx_is_null_str(s) ((s) == NULL || (s)->data == NULL || (s)->len == 0 || ((s)->data[0] == '\0' && (s)->len == 1))
                                 ^
/usr/local/src/ngx_waf/src/ngx_http_waf_module_config.c:833:13: note: in expansion of macro ‘ngx_is_null_str’
         if (ngx_is_null_str(&sitekey)) {
             ^
cc1: all warnings being treated as errors
make[1]: *** [objs/addon/src/ngx_http_waf_module_config.o] Error 1
make[1]: Leaving directory `/usr/local/src/nginx-1.20.1'
make: *** [build] Error 2
ADD-SP commented 1 year ago

请尝试升级 gcc 版本。