Using nginx 1.1 with the intel compiler

Maxim Dounin mdounin at mdounin.ru
Sat Feb 25 02:06:28 UTC 2012


Hello!

On Sat, Feb 25, 2012 at 02:22:36PM +1300, Ryan Brown wrote:

> Though it actually compiles to a point then errors... (ignoring the
> -Wunused-value warnings)
> 
> [root at bob:~/trunk]# export | grep cc
> CC='icc  -I/usr/include/i386-linux-gnu/'
> LD_LIBRARY_PATH=/opt/intel/composer_xe_2011_sp1.9.293/compiler/lib/ia32:/opt/intel/composer_xe_2011_sp1.9.293/ipp/../compiler/lib/ia32:/opt/intel/composer_xe_2011_sp1.9.293/ipp/lib/ia32:/opt/intel/composer_xe_2011_sp1.9.293/compiler/lib/ia32:/opt/intel/composer_xe_2011_sp1.9.293/mkl/lib/ia32:/opt/intel/composer_xe_2011_sp1.9.293/tbb/lib/ia32//cc4.1.0_libc2.4_kernel2.6.16.21:/opt/intel/composer_xe_2011_sp1.9.293/debugger/lib/ia32:/opt/intel/composer_xe_2011_sp1.9.293/mpirt/lib/ia32
> LIBRARY_PATH=/opt/intel/composer_xe_2011_sp1.9.293/compiler/lib/ia32:/opt/intel/composer_xe_2011_sp1.9.293/ipp/../compiler/lib/ia32:/opt/intel/composer_xe_2011_sp1.9.293/ipp/lib/ia32:/opt/intel/composer_xe_2011_sp1.9.293/compiler/lib/ia32:/opt/intel/composer_xe_2011_sp1.9.293/mkl/lib/ia32:/opt/intel/composer_xe_2011_sp1.9.293/tbb/lib/ia32//cc4.1.0_libc2.4_kernel2.6.16.21
> cc=icc
> [root at bob:~/trunk]# icc --version
> icc (ICC) 12.1.3 20120212
> Copyright (C) 1985-2012 Intel Corporation.  All rights reserved.

Could you please show "icc -v" and "icc -V" output?

[...]

> -I src/event/modules -I src/os/unix -I objs \
>                 -o objs/src/core/ngx_string.o \
>                 src/core/ngx_string.c
> icc: command line warning #10006: ignoring unknown option '-Wunused-value'
> src/core/ngx_string.c(1519): error: identifier "bool" is undefined
>       (bool) state = 0;
>        ^
> 
> src/core/ngx_string.c(1519): error: expected a ";"
>       (bool) state = 0;
>              ^

Note: this is *not* original nginx code.  There is no "(bool)" 
cast in nginx here, just plain assignment.

With original code you'll get "error #188: enumerated type mixed 
with another type" as in your previous message, and this warning 
is expected to be disabled with icc, see auto/cc/icc:

...
# enumerated type mixed with another type
CFLAGS="$CFLAGS -wd188"
...

> from a ./configure
> 
> [root at bob:~/trunk]# ./configure
> checking for OS
>  + Linux 3.2.5-ck1 i686
> checking for C compiler ... found
>  + using GNU C compiler
>  + gcc version: 4.6.0 compatibility)

It looks like newer icc pretend to be compatible with gcc 
somewhere in "icc -v" output, and nginx incorrectly mishandles it 
as gcc as a result.

Something like this should help:

diff --git a/auto/cc/name b/auto/cc/name
--- a/auto/cc/name
+++ b/auto/cc/name
@@ -64,16 +64,16 @@ if [ "$CC" = bcc32 ]; then
     echo " + using Borland C++ compiler"
 
 else
+if `$CC -V 2>&1 | grep '^Intel(R) C' >/dev/null 2>&1`; then
+    NGX_CC_NAME=icc
+    echo " + using Intel C++ compiler"
+
+else
 if `$CC -v 2>&1 | grep 'gcc version' >/dev/null 2>&1`; then
     NGX_CC_NAME=gcc
     echo " + using GNU C compiler"
 
 else
-if `$CC -V 2>&1 | grep '^Intel(R) C' >/dev/null 2>&1`; then
-    NGX_CC_NAME=icc
-    echo " + using Intel C++ compiler"
-
-else
 if `$CC -V 2>&1 | grep 'Sun C' >/dev/null 2>&1`; then
     NGX_CC_NAME=sunc
     echo " + using Sun C compiler"


Alternatively, you may set CFLAGS in the environment yourself, 
this will prevent nginx from setting them by it's own.  Something 
like

CFLAGS="-W -g" ./configure

should work.

> But when it comes to compiling it uses icc (as above), the machine
> does have gcc-4.6 installed also
> 
> I didn't see any error messages in auto/cc/icc, I did noticed it
> reference icc up to 11.x but not 12?

We don't generally use icc, though occasionally check compilation 
if found one available.  There were no tests with 12.x yet, though 
it's likely will be ok once correctly detected.

Maxim Dounin

> 
> 
> 2012/2/25 Maxim Dounin <mdounin at mdounin.ru>:
> > Hello!
> >
> > On Sat, Feb 25, 2012 at 12:48:34PM +1300, Ryan Brown wrote:
> >
> >> Any clues on this?
> >
> > It looks like you somehow persuaded nginx that your compiler is
> > gcc, and it uses command line arguments appropiate for gcc instead
> > of ones for icc.  See auto/cc/icc for a long list of warnings which
> > should be ignored with icc.
> >
> > Maxim Dounin
> >
> >>
> >> On Thu, Feb 23, 2012 at 10:36 AM, Ryan Brown <mp3geek at gmail.com> wrote:
> >> > Okay, manage to get it to compile,
> >> >
> >> > make[1]: Entering directory `/root/trunk'
> >> > /opt/intel/bin/icc -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_string.o \
> >> >                src/core/ngx_string.c
> >> > icc: command line warning #10006: ignoring unknown option '-Wunused-value'
> >> > src/core/ngx_string.c(1519): error #188: enumerated type mixed with another type
> >> >      state = 0;
> >> >            ^
> >> >
> >> > compilation aborted for src/core/ngx_string.c (code 2)
> >> > make[1]: *** [objs/src/core/ngx_string.o] Error 2
> >>
> >> _______________________________________________
> >> nginx mailing list
> >> nginx at nginx.org
> >> http://mailman.nginx.org/mailman/listinfo/nginx
> >
> > _______________________________________________
> > nginx mailing list
> > nginx at nginx.org
> > http://mailman.nginx.org/mailman/listinfo/nginx
> 
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx



More information about the nginx mailing list