Does not compile with gcc 4.6.2
Hi, Valery
I've tried to compile other nginx versions (1.0.11 - 1.1.15) on server with gcc 4.6.2 with last (https://github.com/vkholodkov/nginx-eval-module/commit/125fa2e97399d29ce148f55cc6975268e482d212) version of that module and it was failed with such errors:
../nginx-eval-module/ngx_http_eval_module.c: In function ‘ngx_http_eval_block’: ../nginx-eval-module/ngx_http_eval_module.c:640:39: error: variable ‘pclcf’ set but not used [-Werror=unused-but-set-variable] ../nginx-eval-module/ngx_http_eval_module.c:631:32: error: variable ‘ecf’ set but not used [-Werror=unused-but-set-variable] The problem is - new gcc becomes smarter and for now unused variables throws warnings. Nginx default config is: -Werror=unused-but-set-variable] BTW, with gcc 4.5.2 all was compiled successfully. So, it would be great to fix module instead of changing nginx default options.
Thank you! Vadim.
I ask the question in ServerFault (http://serverfault.com/questions/507909/getting-a-build-error-when-installing-a-nginx-eval-module/507916?noredirect=1). They told me to remove the -Werror in objs/Makefile. So I did... And now it works. But I am not sure this is best thing to do.
@vadim-skorba as it work for you? Have you been able to make eval work?
Yes, I compiled this module after fixing of source. You can just comment out warnings. There defined pclcf and ecf variables, but not used. See ngx_http_eval_module.c:640:39 and ngx_http_eval_module.c:631:32 Comment out definitions by using /* */ and you'll be able to compile it. Suppress warnings will work too, but it could lead to problems in other parts of code.
Yes, I have not been able to use eval for some reason. Could that be the problem?
I am confused. Where is ngx_http_eval_module.c:640:39 and ngx_http_eval_module.c:631:32?
640, and 631 indicate what? Also 39, and 32 indicate what exactly?
That's filename.c:linenumber:column
Sorry, I made a mistake. I had a very old version of nginx eval module. This was the reason of the confusion.
But I am still getting errors even after doing what you said:
/root/src/nginx-eval-module/ngx_http_eval_module.c: In function ‘ngx_http_eval_block’: /root/src/nginx-eval-module/ngx_http_eval_module.c:675:5: error: ‘ecf’ undeclared (first use in this function) /root/src/nginx-eval-module/ngx_http_eval_module.c:675:5: note: each undeclared identifier is reported only once for each function it appears in /root/src/nginx-eval-module/ngx_http_eval_module.c:677:5: error: ‘pclcf’ undeclared (first use in this function) make[1]: *** [objs/addon/nginx-eval-module/ngx_http_eval_module.o] Error 1 make[1]: Leaving directory `/root/src/nginx-1.2.7' make: *** [build] Error 2
It all works now. Thanks for the help.
I just needed to comment out ngx_http_eval_module.c:675:5 and ngx_http_eval_module.c:675:5.
The latest change should fix it, I hope.