wargio / naxsi

NAXSI is an open-source, high performance, low rules maintenance WAF for NGINX
GNU General Public License v3.0
305 stars 38 forks source link

Error when run make #123

Closed tapsu01 closed 10 months ago

tapsu01 commented 10 months ago

Hi, when I run make, I get response error below, please check for me, thank you. Details

Nginx Logs

../naxsi/naxsi_src/naxsi_utils.c: In function ‘naxsi_is_illegal_host_name’:
../naxsi/naxsi_src/naxsi_utils.c:1170:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
   for (size_t i = 1; i < plen; ++i) {
   ^
../naxsi/naxsi_src/naxsi_utils.c:1170:3: note: use option -std=c99 or -std=gnu99 to compile your code
../naxsi/naxsi_src/naxsi_utils.c:1196:15: error: redefinition of ‘i’
   for (size_t i = 0; i < n_cidrs; ++i) {
               ^
../naxsi/naxsi_src/naxsi_utils.c:1170:15: note: previous definition of ‘i’ was here
   for (size_t i = 1; i < plen; ++i) {
               ^
../naxsi/naxsi_src/naxsi_utils.c:1196:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
   for (size_t i = 0; i < n_cidrs; ++i) {
   ^
../naxsi/naxsi_src/naxsi_utils.c: In function ‘naxsi_generate_request_id’:
../naxsi/naxsi_src/naxsi_utils.c:1219:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
   for (size_t i = 0; i < len; i++) {
   ^
make[1]: *** [objs/addon/naxsi_src/naxsi_utils.o] Error 1
wargio commented 10 months ago

which version of gcc are you using? also add this to the CFLAGS: -std=gnu99

tapsu01 commented 10 months ago

which version of gcc are you using? also add this to the CFLAGS: -std=gnu99

I use gcc version 4.8.5

wargio commented 10 months ago

that is very old. anyway if you pass CFLAGS="-std=gnu99" ./configure --prefix=/etc/nginx --add-dynamic-module=../naxsi/naxsi_src it should compile.

tapsu01 commented 10 months ago

that is very old. anyway if you pass CFLAGS="-std=gnu99" ./configure --prefix=/etc/nginx --add-dynamic-module=../naxsi/naxsi_src it should compile.

Tks you very much, I compiled success.