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

icc/icpc 14 with gcc 4.8.1 seeing gcc 4.7 headers - compile error: __allocator_base is not a template

Michael_B_20
Beginner
1,386 Views

I know this was asked before without a practicable solution, so sorry to be anoying by asking again:

On LinuxMint 15 (=Ubuntu raring) 64-bit with both gcc 4.7 and 4.8.1 istalled (gcc 4.8.1 made the default compiler), compiling a simple "hello world" test proggy crashes with:

In file included from /usr/include/c++/4.8/string(41),
                 from /usr/include/c++/4.8/bits/locale_classes.h(40),
                 from /usr/include/c++/4.8/bits/ios_base.h(41),
                 from /usr/include/c++/4.8/ios(42),
                 from /usr/include/c++/4.8/ostream(38),
                 from /usr/include/c++/4.8/iostream(39),
                 from test.cpp(1):
/usr/include/c++/4.8/bits/allocator.h(92): error: __allocator_base is not a template
      class allocator: public __allocator_base<_Tp>

gcc just compiles it like a charm, icc/icpc don't.

gcc -v
Es werden eingebaute Spezifikationen verwendet.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Ziel: x86_64-linux-gnu
Konfiguriert mit: ../src/configure -v --with-pkgversion='Ubuntu 4.8.1-2ubuntu1~13.04' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread-Modell: posix
gcc-Version 4.8.1 (Ubuntu 4.8.1-2ubuntu1~13.04)

g++ -v
Es werden eingebaute Spezifikationen verwendet.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Ziel: x86_64-linux-gnu
Konfiguriert mit: ../src/configure -v --with-pkgversion='Ubuntu 4.8.1-2ubuntu1~13.04' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread-Modell: posix
gcc-Version 4.8.1 (Ubuntu 4.8.1-2ubuntu1~13.04)

icc -v
icc version 14.0.1 (gcc version 4.8.0 compatibility)
icpc -v
icpc version 14.0.1 (gcc version 4.8.0 compatibility)
(diagnostic files for icc/icpc attached to this post)

As tracking it down from another thread, I guess that icc/icpc includes wrong limits.h (from gcc 4.7). None of the mentioned workarounds do the job. Is there a solution without completely uninstalling gcc 4.7 (which would cause my system to deinstall essential build tools, too)?

Kind regards,

Michael





0 Kudos
1 Solution
Melanie_B_Intel
Employee
1,387 Views

Thanks for the report. DPD200249811 is tracking the issue. It occurs when you're using gcc 4.8, and both gcc 4.8 and 4.7 are installed on the system.  A workaround isn't available yet.

View solution in original post

0 Kudos
11 Replies
MalReddy_Y_Intel
Employee
1,386 Views

Hi,

Check the gcc/g++ system include search paths using the below command,

#cpp -x c -v

#cpp -x c++ -v

If wrong system headers path (gcc 4.7 related) is listed, then try to override the system include PATH

using the “-I <gcc 4.8 system header path>” option in the command line.

If gcc/g++ ignores “-I” option then try with “-isystem< gcc 4.8 system header path > “ option.

 Still didn’t work, Let us know the output of below command.

# icpc -isystem< gcc 4.8 system header path >  -c helloworld.c –v

Reddy

0 Kudos
Michael_B_20
Beginner
1,387 Views

I stepped on tracking it down by using cpp -x c -v, which showed 2 include-dirs missing ("nicht vorhandenes Verzeichnis"):
Es werden eingebaute Spezifikationen verwendet.
COLLECT_GCC=cpp
Ziel: x86_64-linux-gnu
Konfiguriert mit: ../src/configure -v --with-pkgversion='Ubuntu 4.8.1-2ubuntu1~13.04' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread-Modell: posix
gcc-Version 4.8.1 (Ubuntu 4.8.1-2ubuntu1~13.04)
COLLECT_GCC_OPTIONS='-E' '-v' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/4.8/cc1 -E -quiet -v -imultilib . -imultiarch x86_64-linux-gnu - -mtune=generic -march=x86-64 -fstack-protector
nicht vorhandenes Verzeichnis »/usr/local/include/x86_64-linux-gnu« wird ignoriert
nicht vorhandenes Verzeichnis »/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../x86_64-linux-gnu/include« wird ignoriert
#include "..." - Suche beginnt hier:
#include <...> - Suche beginnt hier:
 /opt/intel/composer_xe_2013_sp1.1.106/mkl/include
 /opt/intel/composer_xe_2013_sp1.1.106/tbb/include
 /usr/lib/gcc/x86_64-linux-gnu/4.8/include
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
Ende der Suchliste.

Nevertheless, it's still not doing what it is expected to do. It seems that the include files for gcc 4.8 reside in /usr/include/c++/4.8 - this is the output you requested:
icpc -isystem< /usr/include/c++/4.8 > -c test.cpp -v
icpc version 14.0.1 (gcc version 4.8.0 compatibility)

0 Kudos
Melanie_B_Intel
Employee
1,388 Views

Thanks for the report. DPD200249811 is tracking the issue. It occurs when you're using gcc 4.8, and both gcc 4.8 and 4.7 are installed on the system.  A workaround isn't available yet.

0 Kudos
Michael_B_20
Beginner
1,387 Views

Hi Mel, thanks for the clear statement. Hope this can be solved in the future.

0 Kudos
Melanie_B_Intel
Employee
1,387 Views

For the hello world test case, using this workaround cleared up the problem, when compiling with gcc 4.8.0 compatibility mode (not when using gcc 4.7 compatibility mode):

 icpc hello.cpp -I/usr/include/x86_64-linux-gnu/c++/4.8/

(There's a include search path issue, using this -I option allows the correct bits/c++config.h to be found)

0 Kudos
Jason_M_3
Beginner
1,387 Views

Using the -I option does fix the hello world test case for me as well but still has problems for more complicated cases. For example, I have a simple program that uses the Boost libraries which compiles fine using g++ 4.8 (even with the additional include flag), however, if I switch to icc there are several errors.

Any word on the progress of this issue?

0 Kudos
Melanie_B_Intel
Employee
1,387 Views

It looks like DPD200249811 is on track to be fixed in the next update.

0 Kudos
tp5
New Contributor I
1,387 Views


This problem also occurs when GCC 4.7 is not installled.

The workaround is simple.

$ sudo apt-get install gcc-4.7 g++-4.7

$ icc -gcc-name=gcc-4.7
$ icpc -gxx-name=g++-4.7

0 Kudos
tp5
New Contributor I
1,387 Views

I can confirm this is fixed in 14.0.2 20140120.

0 Kudos
Shahzad_Malik_MUZAFF
1,387 Views

Is 14.0.2 already available?
 

0 Kudos
Arnstein_R_
Beginner
1,387 Views

Yes. Release notes for 14.0.2 (2013 SP1 Update 2) can be found here:

http://software.intel.com/en-us/articles/intel-c-composer-xe-2013-sp1-release-notes

 

0 Kudos
Reply