nginx-eval-module icon indicating copy to clipboard operation
nginx-eval-module copied to clipboard

Does not compile with gcc 4.6.2

Open vadim-skorba opened this issue 13 years ago • 8 comments

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.

vadim-skorba avatar Feb 07 '12 17:02 vadim-skorba

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?

jnbdz avatar May 16 '13 21:05 jnbdz

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.

vadim-skorba avatar May 16 '13 21:05 vadim-skorba

Yes, I have not been able to use eval for some reason. Could that be the problem?

jnbdz avatar May 16 '13 22:05 jnbdz

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?

jnbdz avatar May 17 '13 00:05 jnbdz

That's filename.c:linenumber:column

vadim-skorba avatar May 17 '13 00:05 vadim-skorba

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

jnbdz avatar May 17 '13 00:05 jnbdz

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.

jnbdz avatar May 17 '13 01:05 jnbdz

The latest change should fix it, I hope.

vkholodkov avatar Jun 24 '15 08:06 vkholodkov