Community
cancel
Showing results for 
Search instead for 
Did you mean: 
528 Views

“identifier ”_Node_allocator“ is undefined” when compiling C++ file using std::map with icpc

Jump to solution

I am trying to compile the following code:

#include <map>

int main() {
  std::map<double, double> test;

  return 0;
}

using the following command:

icpc -I /usr/include/x86_64-linux-gnu/c++/8  main.cpp -o test

I get the following error:

/usr/include/c++/8/bits/stl_tree.h(700): error: identifier 
"_Node_allocator" is undefined
            _GLIBCXX_NOEXCEPT_IF(

            ^
          detected during instantiation of "std::_Rb_tree<_Key, _Val, 
_KeyOfValue, _Compare, _Alloc>::_Rb_tree_impl<_Key_compare, 
<unnamed>>::_Rb_tree_impl() [with _Key=double, _Val=std::pair<const 
double, double>, _KeyOfValue=std::_Select1st<std::pair<const double,double>>, _Compare=std::less<double>, Alloc=std::allocator<std::pair<const double, double>>,_Key_compare=std::less<double>, <unnamed>=true]"
at line 6 of "main.cpp"

together with a handful of type traits errors like the following:

/usr/include/c++/8/type_traits(921): error: not a class or struct name
      : public __is_default_constructible_atom<_Tp>::type
               ^
          detected during:
            instantiation of class 
"std::__is_default_constructible_safe<_Tp, false> [with _Tp=<error-
type>]" at line 927
            instantiation of class "std::is_default_constructible<_Tp> 
[with _Tp=<error-type>]" at line 144
            instantiation of class "std::__and_<_B1, _B2> [with 
_B1=std::is_default_constructible<<error-type>>, 
_B2=std::__is_nt_default_constructible_impl<<error-type>, false>]" at 
line 995
            instantiation of class 
"std::is_nothrow_default_constructible<_Tp> [with _Tp=<error-type>]" 
at line 700 of "/usr/include/c++/8/bits/stl_tree.h"
            instantiation of "std::_Rb_tree<_Key, _Val, _KeyOfValue, 
_Compare, _Alloc>::_Rb_tree_impl<_Key_compare, 
<unnamed>>::_Rb_tree_impl() [with _Key=double, _Val=std::pair<const 
double, double>, _Key
OfValue=std::_Select1st<std::pair<const double, double>>, 
_Compare=std::less<double>, _Alloc=std::allocator<std::pair<const 
double, double>>, _Key_compare=std::less<double>, <unnamed>=true]" at 
line 6 of "
main.cpp"

This code compiles without a problem using g++.

The result of icpc and g++ version commands give the following:

> icpc -v
icpc version 18.0.3 (gcc version 8.1.0 compatibility)

> g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 
8.1.0-5ubuntu1~16.04' --with-bugurl=file:///usr/share/doc/gcc-
8/README.Bugs --enable-
languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --
with-gcc-major-version-only --program-suffix=-8 --program-
prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --
libexecdir=/usr/lib --without-included-gettext --enable-
threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --
enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-
time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object 
--disable-vtable-verify --enable-libmpx --enable-plugin --with-
system-zlib --with-target-system-zlib --enable-objc-gc=auto --
enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-
tune=generic --enable-offload-targets=nvptx-none --without-cuda-
driver --enable-checking=release --build=x86_64-linux-gnu --
host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 8.1.0 (Ubuntu 8.1.0-5ubuntu1~16.04) 

So my icpc and g++ version are compatible. I also didn't forget to source the compilervars.sh file of icpc.

I can't find any post with this error. Is there a specific library needed to add to icpc that is not added automatically to be able to use std::map?

I've tried adding -lstdc++ myself in the compilation command but this didn't work.

0 Kudos
1 Solution
Viet_H_Intel
Moderator
528 Views

 

I don't think ICC 18.0.3 is compatible with GNU 8.1. ICC 18.0.3 is supported GCC from 4.3 to 6.3.

You can read "System requirements" at https://software.intel.com/en-us/articles/intel-c-compiler-180-for-linux-release-notes-for-intel-parallel-studio-xe-2018 

Thanks,

Viet 

View solution in original post

8 Replies
Viet_H_Intel
Moderator
529 Views

 

I don't think ICC 18.0.3 is compatible with GNU 8.1. ICC 18.0.3 is supported GCC from 4.3 to 6.3.

You can read "System requirements" at https://software.intel.com/en-us/articles/intel-c-compiler-180-for-linux-release-notes-for-intel-parallel-studio-xe-2018 

Thanks,

Viet 

View solution in original post

528 Views

Thank you for your response !

This seems really confusing !

 

> icpc -v
icpc version 18.0.3 (gcc version 8.1.0 compatibility)


says that icpc 18.0.3 is compatible with gcc 8.1.0, but indeed as the site you linked it says it's compatible with gcc 4.3 - 6.3.

I will try to connect my icc with an older gcc version and see if it works then.

Thanks !

Viet_H_Intel
Moderator
528 Views

 

That message, somehow is misleading. "icc -v" detects the default GCC version installed on your system and say "compatibility", but it isn't.

It should work if you have 6.3 installed.

Thanks,

Viet

528 Views

This was it ! 

So to fix it I first installed gcc-6 and g++-6, which was done with the following commands on Ubuntu 16.04

 

sudo apt-get install gcc-6 g++-6


Then I added the following flag to my compiler flags:

 

-gxx-name=/usr/bin/g++-6


And then changed my include folder to be version 6 instead of 8:

 

-I /usr/include/x86_64-linux-gnu/c++/6



Thanks !!

528 Views

Hi,

I encountered the same issue with std::map. I'm using Fedora 29 here (gcc 8.1.1). Since there is  no  official package for gcc-6.3 that can be installed on F29, I simply downloaded of an old rpm of libstdc++-devel-6.3.1 and unpacked the header files into /usr/local/include/c++

So far it has worked fine, programs compile and link without problems, but I wonder if it could be necessary to install gcc and the standard libraries? I don't think that gcc-6.3 supports c++17, while ICC 18 does, am I wrong?

Viet_H_Intel
Moderator
528 Views

 

Seems like GNU 6.3 does support c++17

vahoang@orcsle147:/tmp$ g++ t.cpp -std=c++17 -c
vahoang@orcsle147:/tmp$ g++ -v

... ... ...

gcc version 6.3.0 (GCC)

 

 

 

528 Views
Hello, Yes it's true that gcc 6.3 supports C++17, at least partially. According to this page https://gcc.gnu.org/projects/cxx-status.html#cxx17 not all the features were implemented at the time. That's why I was wondering if ICPC, which relies on gcc-6.3 headers, fully supports it. Giuseppe
528 Views

P.S.:

Ok, I see that some C++17 features are not supported, as from this page

https://software.intel.com/en-us/articles/c17-features-supported-by-intel-c-compiler

In fact I couldn't make a fold expression work.

Reply