3

Today I've been working on setting up extra VPS clones and I've run into a strange and frustrating compile time error with the latest nginx development version (0.9.6).

I'm running Ubuntu 10.04.2 LTS x86_64, however, I've upgraded GCC to 4.6.1. ./configure runs without errors, but upon running make -j4 I'm presented with the following error:

gcc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Wunused-function -Wunused-variable -Wunused-value -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \ -o objs/src/core/ngx_open_file_cache.o \ src/core/ngx_open_file_cache.c src/core/ngx_resolver.c: In function 'ngx_resolver_process_ptr': src/core/ngx_resolver.c:1425:43: error: variable 'qclass' set but not used [-Werror=unused-but-set-variable] src/core/ngx_resolver.c:1425:36: error: variable 'qtype' set but not used [-Werror=unused-but-set-variable] cc1: all warnings being treated as errors

make[1]: * [objs/src/core/ngx_resolver.o] Error 1 make[1]: * Waiting for unfinished jobs.... make[1]: Leaving directory `/root/nginx-0.9.6' make: *** [build] Error 2

(Better seen at pastebin: http://pastebin.com/g0bNS2nY)

I've tried adding --with--cc-opt="-W" to the ./configure options but without result. Can anyone please shed some light on this show stopper?

Many, many thanks in advance!

1
  • 1
    Well yes, this is a Release Candidate for gcc-4.6.0. And BTW, 4.6.0 has been released four days later. Mar 27, 2011 at 20:29

2 Answers 2

11

A nicer way to do this is to pass the following to ./configure

--with-cc-opt=-Wno-error
1
  • This worked really well when my nginx compile started throwing src/core/nginx.c:1118: warning: unused parameter ‘cmd’ errors.
    – Nick
    Sep 11, 2013 at 8:44
4

Edit the Makefile, remove -Werror. That options means: quit the compiler immediately if something doesn't seem right. Or run the compile command that went wrong manually, again without the -Werror flag:

gcc -c -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Wunused-function \
 -Wunused-variable -Wunused-value -g  -Isrc/core -Isrc/event \
 -Isrc/event/modules -Isrc/os/unix -Iobjs \
 -o objs/src/core/ngx_open_file_cache.o src/core/ngx_open_file_cache.c
2
  • Thank you - for anyone else with this problem run your ./configure options then afterwards edit the generated objs/Makefile and remove the -Werror switch. Running make -j4 worked like a dream afterwards! Mar 27, 2011 at 18:30
  • @Peter: does this package really put -Werror in its production build settings?
    – Fred Foo
    Mar 27, 2011 at 18:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.