[GH-ISSUE #69] amazon linux 2 编译出错 #185

Closed
opened 2026-03-13 16:47:48 +03:00 by kerem · 2 comments
Owner

Originally created by @purplegrape on GitHub (Oct 9, 2021).
Original GitHub issue: https://github.com/ADD-SP/ngx_waf/issues/69

环境: Amazon LInux 2 + gcc 7.3.1
版本: nginx 1.20.1 + ngx_waf 6.1.5

编译参数如下

  • ./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --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=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --add-dynamic-module=ngx_waf-6.1.5 --with-compat '--with-cc-opt=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -std=gnu99 ' '--with-ld-opt=-Wl,-z,relro -Wl,-z,now ' --with-debug

报错信息如下

  • make modules
    make -f objs/Makefile modules
    make[1]: Entering directory /home/ec2-user/rpmbuild/BUILD/nginx-module-waf-1.20.1' 此处省略N字 ngx_waf-6.1.5/src/ngx_http_waf_module_vm.c cc -c -fPIC -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -std=gnu99 -I src/core -I src/event -I src/event/modules -I src/os/unix -I ngx_waf-6.1.5/inc -I ngx_waf-6.1.5/inc/libinjection/src -I objs -I src/http -I src/http/modules -I src/http/v2 -I src/mail -I src/stream \ -o objs/addon/src/ngx_http_waf_module_lexer.o \ ngx_waf-6.1.5/src/ngx_http_waf_module_lexer.c src/ngx_http_waf_module_lexer.c: In function 'ngx_http_waf_lex': src/ngx_http_waf_module_lexer.c:933:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] src/ngx_http_waf_module_lexer.c: In function 'ngx_http_waf__scan_bytes': src/ngx_http_waf_module_lexer.c:1986:17: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] cc1: all warnings being treated as errors make[1]: *** [objs/addon/src/ngx_http_waf_module_lexer.o] Error 1 make[1]: Leaving directory /home/ec2-user/rpmbuild/BUILD/nginx-module-waf-1.20.1'
    make: *** [modules] Error 2
    error: Bad exit status from /var/tmp/rpm-tmp.0OwOq2 (%build)

RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.0OwOq2 (%build)

Originally created by @purplegrape on GitHub (Oct 9, 2021). Original GitHub issue: https://github.com/ADD-SP/ngx_waf/issues/69 环境: Amazon LInux 2 + gcc 7.3.1 版本: nginx 1.20.1 + ngx_waf 6.1.5 编译参数如下 + ./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --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=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --add-dynamic-module=ngx_waf-6.1.5 --with-compat '--with-cc-opt=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -std=gnu99 ' '--with-ld-opt=-Wl,-z,relro -Wl,-z,now ' --with-debug 报错信息如下 + make modules make -f objs/Makefile modules make[1]: Entering directory `/home/ec2-user/rpmbuild/BUILD/nginx-module-waf-1.20.1' 此处省略N字 ngx_waf-6.1.5/src/ngx_http_waf_module_vm.c cc -c -fPIC -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -std=gnu99 -I src/core -I src/event -I src/event/modules -I src/os/unix -I ngx_waf-6.1.5/inc -I ngx_waf-6.1.5/inc/libinjection/src -I objs -I src/http -I src/http/modules -I src/http/v2 -I src/mail -I src/stream \ -o objs/addon/src/ngx_http_waf_module_lexer.o \ ngx_waf-6.1.5/src/ngx_http_waf_module_lexer.c src/ngx_http_waf_module_lexer.c: In function 'ngx_http_waf_lex': src/ngx_http_waf_module_lexer.c:933:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] src/ngx_http_waf_module_lexer.c: In function 'ngx_http_waf__scan_bytes': src/ngx_http_waf_module_lexer.c:1986:17: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] cc1: all warnings being treated as errors make[1]: *** [objs/addon/src/ngx_http_waf_module_lexer.o] Error 1 make[1]: Leaving directory `/home/ec2-user/rpmbuild/BUILD/nginx-module-waf-1.20.1' make: *** [modules] Error 2 error: Bad exit status from /var/tmp/rpm-tmp.0OwOq2 (%build) RPM build errors: Bad exit status from /var/tmp/rpm-tmp.0OwOq2 (%build)
kerem 2026-03-13 16:47:48 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@ADD-SP commented on GitHub (Oct 9, 2021):

编辑 nginx 源码目录下的 objs/Makefile 文件,删除 CFLAGS 那一行的 -Werror

<!-- gh-comment-id:939265851 --> @ADD-SP commented on GitHub (Oct 9, 2021): 编辑 nginx 源码目录下的 `objs/Makefile` 文件,删除 `CFLAGS` 那一行的 `-Werror`。
Author
Owner

@purplegrape commented on GitHub (Oct 9, 2021):

编译通过,感谢!

<!-- gh-comment-id:939271868 --> @purplegrape commented on GitHub (Oct 9, 2021): 编译通过,感谢!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ngx_waf#185
No description provided.