Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: no class template named ‘rebind’ in ‘class tbb::detail::d1::tbb_allocator<char>’ #383

Closed
Hugh5632 opened this issue Apr 22, 2021 · 14 comments

Comments

@Hugh5632
Copy link

In file included from /opt/rh/devtoolset-9/root/usr/include/c++/9/string:55,
from /opt/rh/devtoolset-9/root/usr/include/c++/9/stdexcept:39,
from /opt/rh/devtoolset-9/root/usr/include/c++/9/array:39,
from /opt/rh/devtoolset-9/root/usr/include/c++/9/tuple:39,
from /opt/rh/devtoolset-9/root/usr/include/c++/9/bits/unique_ptr.h:37,
from /opt/rh/devtoolset-9/root/usr/include/c++/9/memory:80,
from /opt/rh/devtoolset-9/root/usr/include/c++/9/thread:39,
from /root/tbb/oneTBB-2021.2.0/src/tbb/../../include/tbb/../oneapi/tbb/detail/_machine.h:42,
from /root/tbb/oneTBB-2021.2.0/src/tbb/../../include/tbb/../oneapi/tbb/detail/_utils.h:26,
from /root/tbb/oneTBB-2021.2.0/src/tbb/../../include/tbb/../oneapi/tbb/detail/_range_common.h:21,
from /root/tbb/oneTBB-2021.2.0/src/tbb/../../include/tbb/../oneapi/tbb/detail/_concurrent_skip_list.h:25,
from /root/tbb/oneTBB-2021.2.0/src/tbb/../../include/tbb/../oneapi/tbb/concurrent_set.h:21,
from /root/tbb/oneTBB-2021.2.0/src/tbb/../../include/tbb/concurrent_set.h:17,
from /root/tbb/oneTBB-2021.2.0/test/tbb/test_concurrent_set.cpp:20:
/opt/rh/devtoolset-9/root/usr/include/c++/9/bits/basic_string.h: In instantiation of ‘class std::basic_string<char, std::char_traits, tbb::detail::d1::tbb_allocator >’:
/root/tbb/oneTBB-2021.2.0/test/tbb/test_concurrent_set.cpp:66:67: required from ‘void OrderedSetTypesTester::check(const std::list&) [with bool DefCtorPresent = true; ValueType = std::basic_string<char, std::char_traits, tbb::detail::d1::tbb_allocator >]’
/root/tbb/oneTBB-2021.2.0/test/common/concurrent_associative_common.h:871:5: required from ‘void test_set_specific_types() [with Checker = OrderedSetTypesTester]’
/root/tbb/oneTBB-2021.2.0/test/tbb/test_concurrent_set.cpp:72:52: required from here
/opt/rh/devtoolset-9/root/usr/include/c++/9/bits/basic_string.h:3142:63: error: no class template named ‘rebind’ in ‘class tbb::detail::d1::tbb_allocator’
3142 | typedef typename _Alloc::template rebind<_CharT>::other _CharT_alloc_type;
| ^~~~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
make[2]: *** [test/CMakeFiles/test_concurrent_set.dir/tbb/test_concurrent_set.cpp.o] 错误 1
make[1]: *** [test/CMakeFiles/test_concurrent_set.dir/all] 错误 2
make: *** [all] 错误 2

@alexey-katranov
Copy link
Contributor

Do you use Red Hat Developer Toolset?

Can you please check if the issue persists when TBB_ALLOCATOR_TRAITS_BROKEN is defined (e.g. via cmake: -DCMAKE_CXX_FLAGS=-DTBB_ALLOCATOR_TRAITS_BROKEN)?

@kunlinyu
Copy link

kunlinyu commented May 7, 2021

I have similar problem:

[ 16%] Building CXX object test/CMakeFiles/test_malloc_shutdown_hang.dir/tbbmalloc/test_malloc_shutdown_hang.cpp.o
[ 16%] Linking CXX executable ../gnu_5.4_cxx11_64_relwithdebinfo/test_malloc_shutdown_hang
[ 16%] Built target test_malloc_shutdown_hang
Scanning dependencies of target test_malloc_init_shutdown
[ 16%] Building CXX object test/CMakeFiles/test_malloc_init_shutdown.dir/tbbmalloc/test_malloc_init_shutdown.cpp.o
[ 17%] Linking CXX executable ../gnu_5.4_cxx11_64_relwithdebinfo/test_malloc_init_shutdown
[ 17%] Built target test_malloc_init_shutdown
Scanning dependencies of target test_scalable_allocator
[ 18%] Building CXX object test/CMakeFiles/test_scalable_allocator.dir/tbbmalloc/test_scalable_allocator.cpp.o
In file included from /usr/include/c++/5/list:63:0,
from /home/yukunlin/oneTBB/test/common/allocator_stl_test_common.h:62,
from /home/yukunlin/oneTBB/test/tbbmalloc/test_scalable_allocator.cpp:42:
/usr/include/c++/5/bits/stl_list.h: In instantiation of 'class std::__cxx11::_List_base<int, tbb::detail::d1::scalable_allocator >':
/usr/include/c++/5/bits/stl_list.h:507:11: required from 'class std::__cxx11::list<int, tbb::detail::d1::scalable_allocator >'
/home/yukunlin/oneTBB/test/common/allocator_stl_test_common.h:25:6: required by substitution of 'template void TestSequence(const typename Container::allocator_type&) [with Container = std::__cxx11::list<int, tbb::detail::d1::scalable_allocator >]'
/home/yukunlin/oneTBB/test/common/allocator_stl_test_common.h:107:39: required from 'void TestAllocatorWithSTL(const Allocator&) [with Allocator = tbb::detail::d1::scalable_allocator]'
/home/yukunlin/oneTBB/test/tbbmalloc/test_scalable_allocator.cpp:267:58: required from here
/usr/include/c++/5/bits/stl_list.h:315:9: error: no class template named 'rebind' in 'class tbb::detail::d1::scalable_allocator<int>'
_Node_alloc_type;
^
compilation terminated due to -Wfatal-errors.
test/CMakeFiles/test_scalable_allocator.dir/build.make:62: recipe for target 'test/CMakeFiles/test_scalable_allocator.dir/tbbmalloc/test_scalable_allocator.cpp.o' failed
make[2]: *** [test/CMakeFiles/test_scalable_allocator.dir/tbbmalloc/test_scalable_allocator.cpp.o] Error 1
CMakeFiles/Makefile2:909: recipe for target 'test/CMakeFiles/test_scalable_allocator.dir/all' failed
make[1]: *** [test/CMakeFiles/test_scalable_allocator.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2
~/oneTBB/build (master)$ history | tail
7510 mkdir build
7511 cd build/
7512 ls
7513 cmake ../
7514 make -j10
7515 ls
7516 rm * -rf
7517 cmake ..
7518 make
7519 history | tail
~/oneTBB/build (master)$

After i use the flag DTBB_ALLOCATOR_TRAITS_BROKEN like this:
~/oneTBB/build (master)$ cmake .. -DCMAKE_CXX_FLAGS=-DTBB_ALLOCATOR_TRAITS_BROKEN
The problem was gone.

@alexey-katranov
Copy link
Contributor

It seems libstdc++ coming with GCC 5.4 is also broken. Currently, the macro is defined for GCC 5.3 and older:

#if __GXX_EXPERIMENTAL_CXX0X__ && __TBB_GLIBCXX_VERSION <= 50301
    #define TBB_ALLOCATOR_TRAITS_BROKEN 1
#endif

However, it is not clear what libstdc++ version is used by @Hugh5632

@yusxu
Copy link

yusxu commented Jun 30, 2021

Same problem here
Setting flag -DCMAKE_CXX_FLAGS=-DTBB_ALLOCATOR_TRAITS_BROKEN solves my problem

@alexey-katranov
Copy link
Contributor

@Betterxuys , which GCC version do use? Is it 5.4?

@yusxu
Copy link

yusxu commented Jun 30, 2021

@Betterxuys , which GCC version do use? Is it 5.4?

Yes, I am using gcc/g++ 5.4.0

@alexey-katranov
Copy link
Contributor

I would reopen the issue because it is still not fixed in oneTBB:

#if __GXX_EXPERIMENTAL_CXX0X__ && __TBB_GLIBCXX_VERSION <= 50301

notify @anton-potapov @kboyarinov

@fabiencastan
Copy link

Same problem for me with g++-6.3 (from centos 7, devtoolset-6).

@tier-cap
Copy link

also meet the same problem, even with -DCMAKE_CXX_FLAGS=-DTBB_ALLOCATOR_TRAITS_BROKEN, my g++ version is 8.3,
re-open need

@kboyarinov
Copy link
Contributor

kboyarinov commented Nov 9, 2022

@Hugh5632
@tier-cap
@fabiencastan
@yusxu
@kunlinyu

We have made a more detailed check and it seems like the error in basic_string.h refers to the elder implementation of basic_string class that is designed for backward compatibility with C++03 (see Dual ABI for more info).
Setting _GLIBCXX_USE_CXX11_ABI to 1 (that should be 1 by default but may have been changed somewhere in the build system) should workaround this issue and force GCC to use the latest implementation of basic_string.
Could you please check if the newer ABI can be used for you?
We will also discuss how this use case can be supported in oneTBB.

@kboyarinov
Copy link
Contributor

There was a typo in the comment above. Setting _GLIBCXX_USE_CXX11_ABI to 1 not 0 should workaround the issue.
Sorry for the mess. I have edited the comment, just wanted to highlight the change.

sageb0t pushed a commit to sagemath/sagetrac-mirror that referenced this issue Nov 20, 2022
@mkoeppe
Copy link

mkoeppe commented Nov 20, 2022

This workaround does not seem to work for me. This is on ubuntu-trusty with GCC 9 from toolchain ppa. https://github.com/mkoeppe/PySCIPOpt/actions/runs/3506612801/jobs/5873770057

@nofuturre
Copy link

@Hugh5632 is this issue still relevant?

@nofuturre
Copy link

If anyone encounter this issue in the future please open new issue with a link to this one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants