Saturday, June 23, 2007

Using Intel C/C++ Compiler /w kdevelop

I tried out the Intel C/C++ Compiler v10.0 on my Ubuntu/7.04 box. Its free for "personal" use only. Unfortunately, it is a rpm distribution and does not "officially" support Ubuntu Linux. Well, use "alien" to fix that problem and convert the rpm to a debian package. A simple google search will give any1 the steps if interested. So far, it hasn't become painful to use it ... yet. But I did have problems using it out-of-the-box.

First of all, the executable complained about missing "libcxaguard.so.5". Again, google to the rescue and there are several fixes for this problem and obviously I tried the easiest one :). Link with option "-static-libcxa". Unfortunately the executable is bigger than using the shared library. I'll try to post some of the performance comparison with gcc next time.

Secondly, how on earth can I use it with Kdevelop? This one took some time since I'm not very familiar with kdevelop myself and google didn't seem to help much except for other people asking for the same solution. Mingling with kdevelop for about an hour ... got it :D. There is a "iccvars.sh" script in the bin directory ... it sets up the environment vars for the compiler. Just use them in Project->Project Options->Configure Options (I would recommend using a new configuration with gcc's default settings). Here is a snap of the env vars I have set there (same as in the iccvars.sh script):

CC = icc
CXX = icc
INTEL_LICENSE_FILE = ${INTEL_LICENSE_FILE=}:/opt/intel/cc/10.0.023/licenses:/opt/intel/licenses:${HOME}/intel/licenses:/Users/Shared/Library/Application Support/Intel/Licenses
LD_LIBRARY_PATH = LD_LIBRARY_PATH:${LD_LIBRARY_PATH}
MANPATH = /opt/intel/cc/10.0.023/man:${MANPATH}

Also, we need the linker options to link against the
libcxaguard.so.5 ... so add "-static-libcxa -lstdc++" to the LDFLAGS section. Lastly, we need to set the include and lib search path: add "-I/opt/intel/cc/10.0.023/include/ -L/opt/intel/cc/10.0.023/lib" to the C and C++ tabs CXXFLAGS section. Now run automake and friends ... then configure ... build... youre good to go.

















on a last note... i've used the intel directory paths according to my installation. If you have it installed in some other directory... use that one. Happy coding :)

No comments: