Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

to exclude /user/include/c++/4.3 .. old include path and use intel's path

Aniket_P_1
Beginner
1,380 Views

I am working on a cluster which has older version of intel compiler (11) and gcc (4.3).

I have installed a newer trial version of intel composer xe (with 14.0 compiler).  I have also installed gcc 4.9. Both the newer gcc and intel compilers are in my home directory (non-root)

I use C++11 in my codes, so obviously i use -std=c++11 flag for compiling. I provide -L  and -I flags to include intel's includes and libraries in my makefile

When I try to compile my code with icpc, The compiler looks in /user/include/c++/4.3/.... path. I tried to remove the path by setting C_INCLUDE_PATH and CPLUS_INCLUDE_PATH  to /home/aniket/intel/composerxe/include    but it still looks in the /usr/include/c++  path. Because of this, the old files in /user/include/c++/4.3/tr1_impl/ ... are included and not the latest ones.

How do I stop the compiler to look into these paths and see the new ones. Now instead of intel compiler i use gcc4.9, what changes do i need to make ?

0 Kudos
4 Replies
TimP
Honored Contributor III
1,380 Views
Icpc 11.0 isn't compatible with g++ 4.9. If you have icpc 14.0 and set up paths for g++ 4.9 then icpc would share those paths.
0 Kudos
Aniket_P_1
Beginner
1,380 Views

I dont use icpc 11 for my codes. I use intel 14 for compiling my c++11 code which i have installed in my home directory. I unload old intel compiler (11) module and provide my intel 14 icpc path for compiling.

One thing I wanted to ask, does intel compiler use shared paths for gcc includes ?  I ask so because I did not find any c++ include header  in the entire intel installation directory. I tried looking in

intel/composer_xe_2013_sp1.3.174/compiler/include

but I did not find any c++ header. After I compile the code using  "  - H "  flag, which lists all the included files, I found that the compiler uses /usr/include/c++/4.3   path to include c++ headers.  Why doesnt intel provide their own headers as such ?

If I have to bypass /usr/include/c++/4.3   and /usr/lib64/gcc/...   provided by my cluster admin, how should i provide my own paths ? Because I tried to provide /home/aniket/gcc-4.9/include/c++/4.9.0   as include path in my make file. Here is the error what I got:

 

 /home/aniketnp/gcc-4.9/include/c++/4.9.0/iostream
.. /usr/include/c++/4.3/x86_64-suse-linux/bits/c++config.h
... /usr/include/bits/wordsize.h
... /usr/include/c++/4.3/x86_64-suse-linux/bits/os_defines.h
.... /usr/include/features.h
..... /usr/include/sys/cdefs.h
...... /usr/include/bits/wordsize.h
..... /usr/include/gnu/stubs.h
...... /usr/include/bits/wordsize.h
...... /usr/include/gnu/stubs-64.h
... /usr/include/c++/4.3/x86_64-suse-linux/bits/cpu_defines.h
.. /home/aniketnp/gcc-4.9/include/c++/4.9.0/ostream
... /home/aniketnp/gcc-4.9/include/c++/4.9.0/ios
.... /home/aniketnp/gcc-4.9/include/c++/4.9.0/iosfwd
..... /home/aniketnp/gcc-4.9/include/c++/4.9.0/bits/stringfwd.h
...... /home/aniketnp/gcc-4.9/include/c++/4.9.0/bits/memoryfwd.h
In file included from /home/aniketnp/gcc-4.9/include/c++/4.9.0/bits/stringfwd.h(40),
                 from /home/aniketnp/gcc-4.9/include/c++/4.9.0/iosfwd(39),
                 from /home/aniketnp/gcc-4.9/include/c++/4.9.0/ios(38),
                 from /home/aniketnp/gcc-4.9/include/c++/4.9.0/ostream(38),
                 from /home/aniketnp/gcc-4.9/include/c++/4.9.0/iostream(39),
                 from driver.cpp(1):
/home/aniketnp/gcc-4.9/include/c++/4.9.0/bits/memoryfwd.h(50): error: expected a "{"
  namespace std _GLIBCXX_VISIBILITY(default)
                ^

In file included from /home/aniketnp/gcc-4.9/include/c++/4.9.0/bits/stringfwd.h(40),
                 from /home/aniketnp/gcc-4.9/include/c++/4.9.0/iosfwd(39),
                 from /home/aniketnp/gcc-4.9/include/c++/4.9.0/ios(38),
                 from /home/aniketnp/gcc-4.9/include/c++/4.9.0/ostream(38),
                 from /home/aniketnp/gcc-4.9/include/c++/4.9.0/iostream(39),
                 from driver.cpp(1):
/home/aniketnp/gcc-4.9/include/c++/4.9.0/bits/memoryfwd.h(63): error: expected a ";"
    template<typename>
    ^

In file included from /home/aniketnp/gcc-4.9/include/c++/4.9.0/bits/stringfwd.h(40),
                 from /home/aniketnp/gcc-4.9/include/c++/4.9.0/iosfwd(39),
                 from /home/aniketnp/gcc-4.9/include/c++/4.9.0/ios(38),
                 from /home/aniketnp/gcc-4.9/include/c++/4.9.0/ostream(38),
                 from /home/aniketnp/gcc-4.9/include/c++/4.9.0/iostream(39),
                 from driver.cpp(1):
/home/aniketnp/gcc-4.9/include/c++/4.9.0/bits/memoryfwd.h(67): error: allocator is not a template
      class allocator<void>;
            ^

 

 

Also if I do not provide complete path : /home/aniket/gcc-4.9/include/c++/4.9.0    and instead  I provide this : Also if I do not provide complete path : /home/aniket/gcc-4.9/include   the compiler does not bother looking into it.  I am sure all my errors are because of the old tr1_impl  headers  which are implemented in older version ( 4.3 ). 

I just dont know how to restrict the icpc to not look into that dreaded path and set my own path.

Apologies for typos and silly mistakes.

Aniket

 

 

 

 

 

0 Kudos
TimP
Honored Contributor III
1,380 Views

icpc employs the g++ which is found on PATH to find include files, presumably by something like

g++ --print-search-dirs

icpc has a few include files, but most of them are inherited from g++. You may need to look at pre-processed source to see which ones are in use.

There are other methods, current and deprecated, to specify to icpc which g++ is wanted, which I'm not able to explain fully, but they have been discussed on this forum.

I don't think you can remove all include directories from consideration other than by configuring your linux installation, but you can put the gcc installation of your choice ahead of the one provided by your distro.

I suspect icpc 15.0 may be needed to work with g++ 4.9 and 4.10.

0 Kudos
Shenghong_G_Intel
1,380 Views

As Tim mentioned, icpc will use the include files from G++, so, you need to make sure your G++ itself is configured correctly in PATH.

For example, you may set up as below:

# cat /opt/gcc/gcc-4.9.0/bin/gccvars.sh
export NGCCDIR=/opt/gcc/gcc-4.9.0
export PATH=$NGCCDIR/bin:$PATH
export LD_LIBRARY_PATH=$NGCCDIR/lib:$NGCCDIR/lib64:$LD_LIBRARY_PATH
export MANPATH=$NGCCDIR/share/man:$MANPATH
# source /opt/gcc/gcc-4.9.0/bin/gccvars.sh
# g++ --version
g++ (GCC) 4.9.0
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# source /opt/intel/composer_xe_2013_sp1.3.174/bin/compilervars.sh intel64
# Now, when you use "icc/icpc", it should use the headers from G++ 4.9.0.

Hope it helps.

Thanks,

Shenghong

0 Kudos
Reply