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

Using newer version of gcc compilers on Centos 6.x (devtoolset-3) with icc

AndrewC
New Contributor III
766 Views

Our primary development platform on Linux is Centos 6.7  with Composer XE 2015 - the default gcc version is 4.4.7. We need to use C++11 and STL features as supported by gcc 4.9.2. This gcc version can be installed and activated by installing "devtoolset-3" and "enabled"  via "source /opt/rh/devtoolset-3/enable".

I am found two confusing issues. If I compile a C++ file that uses , for example, C++11 <regex> features  this is what I find

Using gcc 4.4.7 : gcc sample.cpp ->does not compile as 4.4.7 does not support std::regex properly

Using gcc 4.9.2 : gcc sample.cpp ->compiles OK, but fails to link with many errors related to "regex".

Using icc ( in gcc 4.9.2 environment)  icc sample.cpp-> compiles AND links and runs OK

I don't really understand why

  • gcc 4.9.2 compiles but does not link to the correct libraries.

while

  • icc ( in gcc 4.9.2 environment) compiles and links (and runs in the default environment)

 

 

0 Kudos
3 Replies
Kittur_G_Intel
Employee
766 Views

Hi @vasci_,
Firstly, its important for you to know that icc is GNU based and uses the gnu asm and linker as well and uses GNU headers and libraries.
So, if icc compiles fine with GCC version 4.9.2 then I also presume it should compile fine with GCC as well, unless there is a library that's being used by ICC that comes within it and used alternatively but that is suspect based on the scenario you indicate. You'll need to investigate further on why it doesn't link when you use gcc standalone. If you can attach a reproducer test case I can take a look at it but I don't have access to CentOS 6.X except for an equivalent EL6 system that I can try on.

Regards,
Kittur

0 Kudos
AndrewC
New Contributor III
766 Views

I found my mistake.

I was not properly enabling the devtools-3 when I was testing the gcc version. I was bouncing from terminal window to terminal window and tested gcc in the wrong active environment.

So it does work as one would expect. Both gcc  and icc compile and link correctly in the devtools-3 environment.

Thanks for looking into this.

 

0 Kudos
Kittur_G_Intel
Employee
766 Views

Great! Thanks for letting me know that you could resolve the issue - appreciate much.

Kittur

0 Kudos
Reply