How to tell icc to use specific gcc c++ header file on Linux?
Hi, everyone I have 2 versions of gcc installed on my system: gcc-4.2.2-1 installed on /usr/local and gcc-4.1.2 installed on /usr. When i use icc compile my c code, as if it always uses c++ header files from gcc-4.2.2-1. But i want to my icc use all the c/c++ header files and libs from gcc-4.1.2, How can i do it for icc???
Thanks! I have tried those options. It seems they do not work. Because i call my icc from nVidia nvcc, i set the option as follows: nvcc -c csub.cu -ccbin icc -Xcompiler -gcc-version=412 It still report me that icc go to gcc-4.2.2 to find some C++ header files and libs. Since i have to use nvcc and icc together and nvcc only supports gcc-4.1.2, there must be some other ways to change the settings of icc.
the option "-gcc-version=XYZ" is optional. You should use "-gcc-name=..." and "-gxx-name=..." in first place. You might also use option "-dryrun" to find out whether the options got forwarded correctly.
It should also be sufficient to change your PATH so that g++-4.1 comes ahead of other gcc/g++ installations; then 'g++ -version' or 'g++ -print-search-dirs' will verify your setup. On some linux installations, the default search order between /usr/bin and /usr/local/ changes, depending on your login route. I prefer to install current gcc in a specific path such as /usr/local/gcc-4.7/ so that it comes on PATH only when I take such action explicitly. Depending on such an old gcc becomes increasingly difficult, as gcc-4.4 is the oldest one in use on recently released linux distros.
Hi Two versions GCC/++ versions or more could be installed in the same directory /usr (prefix) In /usr/bin you have several version gcc-x.x ad g++-.x.x If you want that Intel compiler take specific an version of Gnu compiler you must link or copy the name complete of specific version on short name are same gcc and g++.
Examples: cp /usr/bin/gcc-4.2.2-1 /usr/bin/gcc (icc understand gcc-4.2.2-1 is your gnu compiler) cp /usr/bin/g++-4.2.2-1 /usr/bin/g++ (icc understand g++-4.2.2-1 is your gnu compiler)
cp /usr/bin/gcc-4.1.2 /usr/bin/gcc (icc understand gcc-4.1.2 is your gnu compiler) cp /usr/bin/g++-4.1.2 /usr/bin/g++ (icc understand g++-4.1.2 is your gnu compiler)
With an secondary path repertory (/usr/local) you add a complexity for nothing... Do not worry the two versions of compiler are completely dissociated even in unique directory (/usr/bin) Install the 3 types of version GNU compiler of your distibution you see that the all loader are in /usr/bin
I think,you have now versions more recent that your gcc-4.2.2-1 that could working largely better ... Also on the recent version GNU & ICC you have now new linker (elf,gold) for (IPO / LTO) and several new options that are very performant..
(Always interupted !!!),I finish by step
Refer to this example of an computer in my hand (flags are in bold)
showing where is the path and the specific name ,could be determinate
Using built-in specs.
Hi, everyone,Thanks for your kind advice I just find there is an environmental variable GXX_ROOT ,which points to gcc-4.2.2, in my computer. Changing this variable to a specific version of gcc solves my problem. Thanks all Steve