Using nginx 1.1 with the intel compiler

Not sure what I’m doing wrong here…

[root@bob:~/trunk]# export | grep cc
CC=icc
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

[root@bob:~/trunk]# ./configure
checking for OS

  • Linux 3.2.5 i686
    checking for C compiler … not found

./configure: error: C compiler icc is not found

Even if I specify it,

[root@bob:~/trunk]# ./configure --with-cc=/opt/intel/bin/icc
checking for OS

  • Linux 3.2.5 i686
    checking for C compiler … not found

./configure: error: C compiler /opt/intel/bin/icc is not found

And just specifying “icc” instead"

[root@bob:~/trunk]# ./configure --with-cc=icc
checking for OS

  • Linux 3.2.5 i686
    checking for C compiler … not found

./configure: error: C compiler icc is not found

hmm still not found, its in the path:

[root@bob:~/trunk]# icc --version
icc (ICC) 12.1.3 20120212
Copyright © 1985-2012 Intel Corporation. All rights reserved.

Hello!

On Thu, Feb 23, 2012 at 02:31:31AM +1300, Ryan B. wrote:

checking for C compiler … not found
./configure: error: C compiler /opt/intel/bin/icc is not found
hmm still not found, its in the path:

[root@bob:~/trunk]# icc --version
icc (ICC) 12.1.3 20120212
Copyright © 1985-2012 Intel Corporation. All rights reserved.

Try looking into objs/autoconf.err, it will have exact reason for
the “not found” verdict. Most likely it fails to compile code for
some reason, the autoconf.err file should have details.

Maxim D.

I’m guessing its similar to the openssl compile, which I used
http://software.intel.com/en-us/forums/showthread.php?t=101266

[root@bob:trunk/objs]# locate sys/types.h
/usr/include/i386-linux-gnu/sys/types.h

Not sure how to pass to nginx to use, (this fails)

./configure --with-cc=/opt/intel/bin/icc
–with-cc-opt=-I/usr/include/i386-linux-gnu/


checking for C compiler

objs/autotest.c(2): catastrophic error: cannot open source file
“sys/types.h”
#include <sys/types.h>
^

compilation aborted for objs/autotest.c (code 4)

#include <sys/types.h>

int main() {
;
return 0;
}


icc -o objs/autotest objs/autotest.c

Any clues on this?

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

Hello!

On Sat, Feb 25, 2012 at 12:48:34PM +1300, Ryan B. 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 D.

Though it actually compiles to a point then errors… (ignoring the
-Wunused-value warnings)

[root@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@bob:~/trunk]# icc --version
icc (ICC) 12.1.3 20120212
Copyright (C) 1985-2012 Intel Corporation. All rights reserved.

cc: command line warning #10006: ignoring unknown option
‘-Wunused-value’
icc -I/usr/include/i386-linux-gnu/ -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_hash.o
src/core/ngx_hash.c
icc: command line warning #10006: ignoring unknown option
‘-Wunused-value’
icc -I/usr/include/i386-linux-gnu/ -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_buf.o
src/core/ngx_buf.c
icc: command line warning #10006: ignoring unknown option
‘-Wunused-value’
icc -I/usr/include/i386-linux-gnu/ -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_queue.o
src/core/ngx_queue.c
icc: command line warning #10006: ignoring unknown option
‘-Wunused-value’
icc -I/usr/include/i386-linux-gnu/ -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_output_chain.o
src/core/ngx_output_chain.c
icc: command line warning #10006: ignoring unknown option
‘-Wunused-value’
icc -I/usr/include/i386-linux-gnu/ -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: identifier “bool” is undefined
(bool) state = 0;
^

src/core/ngx_string.c(1519): error: expected a “;”
(bool) state = 0;
^

compilation aborted for src/core/ngx_string.c (code 2)
make[1]: *** [objs/src/core/ngx_string.o] Error 2
make[1]: Leaving directory `/root/trunk’
make: *** [build] Error 2

from a ./configure

[root@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)
    checking for gcc -pipe switch … found
    checking for gcc builtin atomic operations … found
    checking for C99 variadic macros … found
    checking for gcc variadic macros … found
    checking for unistd.h … found
    checking for inttypes.h … found
    checking for limits.h … found
    checking for sys/filio.h … not found
    checking for sys/param.h … found
    checking for sys/mount.h … found
    checking for sys/statvfs.h … found
    checking for crypt.h … found
    checking for Linux specific features
    checking for epoll … found

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?

2012/2/25 Maxim D. [email protected]:

Will try your suggestions…

[root@bob:auto/cc]# icc -v
icc version 12.1.3 (gcc version 4.6.0 compatibility)
[root@bob:auto/cc]# icc -V
Intel(R) C Compiler XE for applications running on IA-32, Version
12.1.3.293 Build 20120212
Copyright (C) 1985-2012 Intel Corporation. All rights reserved.
FOR NON-COMMERCIAL USE ONL

2012/2/25 Maxim D. [email protected]:

Hello!

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

Copyright © 1985-2012 Intel Corporation. All rights reserved.
Could you please show “icc -v” and “icc -V” output?

[…]

         ^

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@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 D.

Generally speaking, we (nginx team) will be grateful for an access to a
host with Intel compiler suit (Intel Parallel Studio XE or Composer
XE) with an appropriate license there.

Or perhaps someone has a right contact in Intel to talk about that.

On 2/25/12 8:28 AM, Ryan B. wrote:

else +if $CC -V 2>&1 | grep '^Intel(R) C'>/dev/null 2>&1;

_______________________________________________ nginx mailing
list [email protected]
nginx Info Page


Maxim K.
+7 (910) 4293178

You’re free to download/install the icc, Installs /opt/intel by default.

But looking at the suggested patch, it looks safe? just changing the
order?

Okay, it managed to compile with your suggested patch, its safe to
push into trunk :slight_smile:

nginx-dev+openssl-dev compiled under icc and working

Yep, icc is free to download.

Intel C++ Compiler (ICC)


http://web.eecs.utk.edu/~lucio/pet/compilerguides/intel-compiler-guide.htm

ICC - From +10% (PHP) to +150% (MySQL)

-

-

http://blog.mudy.info/2009/02/speedup-mysql-and-webserver-with-intel-compiler-and-tcmalloc/

-

C : icc -fast

C++ : icpc -fast

Fortran : ifort -fast

Documentation :

/home/intel/l_ccompxe_intel64_2011.8.273/Documentation/en_US/documentation_c.htm

Videos : Development Tools

Support account :

https://registrationcenter.intel.com/RegCenter/registerexpress.aspx?clientsn=YOURKEY
#sudo cp -fr /www/l_ccompxe_intel64_2011.8.273.tgz
/usr/local/src/l_ccompxe_intel64_2011.8.273.tgz

cd /usr/local/src

sudo rm -fr l_ccompxe_intel64_2011.8.273

sudo wget -O l_ccompxe_intel64_2011.8.273.tgz

http://www.denistruffaut.com/downloads/l_ccompxe_intel64_2011.8.273.tgz

sudo tar -xvzf l_ccompxe_intel64_2011.8.273.tgz

sudo rm -fr l_ccompxe_intel64_2011.8.273.tgz

cd l_ccompxe_intel64_2011.8.273

sudo ./install.sh && cd /usr/local/src

sudo rm -fr l_ccompxe_intel64_2011.8.273

Posted at Nginx Forum:

Hello!

On Wed, Feb 29, 2012 at 09:17:55AM -0500, DenisTRUFFAUT wrote:

Yep, icc is free to download.

Free Intel® Software Development Tools

Intel’s license FAQ clearly states that non-commercial version
can’t be used even for free open-source products if one provide
paid technical support:

That is, we can’t use it.

Maxim D.