Compilation error on CentOS-5.7

Maxim Dounin mdounin at mdounin.ru
Mon Feb 27 15:11:47 UTC 2012


Hello!

On Mon, Feb 27, 2012 at 02:48:06PM +0000, Iqbal Aroussi wrote:

> Hi,
> 
> Can you please help me overcome this problem. I'm trying to compile
> Nginx + nginx_udplog_module
> from source but I get this error: *cc1: warnings being treated as errors*
> I tried with *nginx-1.0.0* the version in our production servers and *
> nginx-1.0.12* the latest stable version.

[...]

> --with-ipv6 --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
> -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64
> -mtune=generic' --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
> -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64
> -mtune=generic' --add-module=/root/nginx_udplog_module-1.0.0

You shoot yourself in the foot by using --with-cc-opt="... -Wall 
...".  This results in:

> gcc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter
> -Wunused-function -Wunused-variable -Wunused-value -Werror -g -O2 -g -pipe
> -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
> --param=ssp-buffer-size=4 -m64 -mtune=generic -I src/core -I src/event -I
> src/event/modules -I src/os/unix -I /usr/include/libxml2 -I objs \
>  -o objs/src/core/nginx.o \
> src/core/nginx.c

I.e. warning options set by nginx (notably "-Wall ... 
-Wno-unused-parameter") are overriden by your "-Wall" which comes 
later, and this results in compilation failure due to "-Werror" 
also set by nginx.

Not passing "-Wall" by hand will fix this while still ensure that 
warnings unexpected in the nginx source code will be fatal.

Maxim Dounin



More information about the nginx mailing list