`error: no type named ‘size_type’` when building with GCC 10.2 on CentOS 7-like
I'm trying to compile TBB inside a quay.io/pypa/manylinux2014_x86_64:2022-10-25-fbea779 Docker image (the manylinux2014 spec is based on CentOS 7, but this image ships GCC 10.2) with the objective of creating manylinux wheels of pygmo2 (see https://github.com/esa/pygmo2/pull/110/). At the moment I am getting this error:
[ 19%] Building CXX object test/CMakeFiles/test_concurrent_unordered_map.dir/tbb/test_concurrent_unordered_map.cpp.o
In file included from /opt/rh/devtoolset-10/root/usr/include/c++/10/string:55,
from /opt/rh/devtoolset-10/root/usr/include/c++/10/bits/locale_classes.h:40,
from /opt/rh/devtoolset-10/root/usr/include/c++/10/bits/ios_base.h:41,
from /opt/rh/devtoolset-10/root/usr/include/c++/10/streambuf:41,
from /opt/rh/devtoolset-10/root/usr/include/c++/10/bits/streambuf_iterator.h:35,
from /opt/rh/devtoolset-10/root/usr/include/c++/10/iterator:66,
from /oneTBB/src/tbb/../../include/tbb/../oneapi/tbb/detail/_range_common.h:25,
from /oneTBB/src/tbb/../../include/tbb/../oneapi/tbb/detail/_concurrent_unordered_base.h:24,
from /oneTBB/src/tbb/../../include/tbb/../oneapi/tbb/concurrent_unordered_map.h:21,
from /oneTBB/src/tbb/../../include/tbb/concurrent_unordered_map.h:17,
from /oneTBB/test/tbb/test_concurrent_unordered_map.cpp:22:
/opt/rh/devtoolset-10/root/usr/include/c++/10/bits/basic_string.h: In instantiation of ‘class std::basic_string<char, std::char_traits<char>, tbb::detail::d1::tbb_allocator<char> >’:
/oneTBB/test/common/concurrent_associative_common.h:964:29: required from ‘void test_map_specific_types() [with Checker = UnorderedMapTypesTester]’
/oneTBB/test/tbb/test_concurrent_unordered_map.cpp:97:54: required from here
/opt/rh/devtoolset-10/root/usr/include/c++/10/bits/basic_string.h:3150:57: error: no type named ‘size_type’ in ‘std::basic_string<char, std::char_traits<char>, tbb::detail::d1::tbb_allocator<char> >::_CharT_alloc_type’ {aka ‘std::allocator_traits<tbb::detail::d1::tbb_allocator<char> >::rebind_alloc<char>’}
3150 | typedef typename _CharT_alloc_type::size_type size_type;
| ^~~~~~~~~
compilation terminated due to -Wfatal-errors.
gmake[2]: *** [test/CMakeFiles/test_concurrent_unordered_map.dir/tbb/test_concurrent_unordered_map.cpp.o] Error 1
gmake[1]: *** [test/CMakeFiles/test_concurrent_unordered_map.dir/all] Error 2
gmake: *** [all] Error 2
To reproduce:
FROM quay.io/pypa/manylinux2014_x86_64:2022-10-25-fbea779
RUN git clone https://github.com/oneapi-src/oneTBB.git
WORKDIR oneTBB
RUN mkdir build
WORKDIR build
RUN cmake ..
RUN cmake --build .
Can you try perhaps with a stable version rather than the git head?
The conda package for pagmo compiled fine with this TBB version:
https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=600240&view=logs&j=656edd35-690f-5c53-9ba3-09c10d0bea97&t=e5c8ab1d-8ff9-5cae-b332-e15ae582ed2d&l=88
(TBB version 2021.6.0)
The error is present both on TBB v2021.3.0, v2021.6.0, and on the most recent one, v2021.7.0. Checked it with
FROM quay.io/pypa/manylinux2014_x86_64:2022-10-25-fbea779
RUN git clone https://github.com/oneapi-src/oneTBB.git
WORKDIR oneTBB
RUN git checkout v2021.3.0
RUN mkdir build
WORKDIR build
RUN cmake ..
RUN cmake --build .
If I add -DCMAKE_CXX_FLAGS=-DTBB_ALLOCATOR_TRAITS_BROKEN, it makes the compilation slower but it seems to have gone past that step. The only other mention I see of that flag in this tracker is gh-383. I have no idea of C++ so I don't know if it's related or not.
@astrojuanlu, could you please check if the newer GLIBCXX ABI can be used as described here?
@kboyarinov Setting _GLIBCXX_USE_CXX11_ABI=0 everywhere did not seem to help. This is the Dockerfile:
FROM quay.io/pypa/manylinux2014_x86_64:2022-10-25-fbea779
RUN git clone https://github.com/oneapi-src/oneTBB.git
WORKDIR oneTBB
RUN git checkout v2021.3.0
RUN mkdir build
WORKDIR build
ENV _GLIBCXX_USE_CXX11_ABI=0
RUN _GLIBCXX_USE_CXX11_ABI=0 cmake ..
RUN _GLIBCXX_USE_CXX11_ABI=0 cmake --build .
And the error is the same.
@astrojuanlu,
There was a typo in the comment I linked above. Setting _GLIBCXX_USE_CXX11_ABI to 1, not 0 should force libstdc++ to use the newest version of std::string. Sorry for this mess.
We will also discuss internally how can we support this use case in oneTBB implementation.
Hi @kboyarinov, no worries. Unfortunately, I still get the same error.
$ docker build .
Sending build context to Docker daemon 2.048kB
Step 1/9 : FROM quay.io/pypa/manylinux2014_x86_64:2022-10-25-fbea779
---> b9afd9d4617f
Step 2/9 : RUN git clone https://github.com/oneapi-src/oneTBB.git
---> Using cache
---> 8aaea1d3d1fa
Step 3/9 : WORKDIR oneTBB
---> Using cache
---> 149aded78448
Step 4/9 : RUN git checkout v2021.3.0
---> Using cache
---> e958ca3fbcb1
Step 5/9 : RUN mkdir build
---> Using cache
---> f168f7f6ab8a
Step 6/9 : WORKDIR build
---> Using cache
---> 4df0c0e794dc
Step 7/9 : ENV _GLIBCXX_USE_CXX11_ABI=1
---> Running in 24bd1a0876fe
Removing intermediate container 24bd1a0876fe
---> 80daa25a4366
Step 8/9 : RUN _GLIBCXX_USE_CXX11_ABI=1 cmake ..
---> Running in c8b9fca0d36b
-- The CXX compiler identification is GNU 10.2.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/rh/devtoolset-10/root/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- CMAKE_BUILD_TYPE is not specified. Using default: RelWithDebInfo
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE
-- Checking for one of the modules 'hwloc'
-- HWLOC target HWLOC::hwloc_1_11 doesn't exist. The tbbbind target cannot be created
-- HWLOC target HWLOC::hwloc_2 doesn't exist. The tbbbind_2_0 target cannot be created
-- HWLOC target HWLOC::hwloc_2_4 doesn't exist. The tbbbind_2_4 target cannot be created
-- The C compiler identification is GNU 10.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/rh/devtoolset-10/root/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /oneTBB/build
Removing intermediate container c8b9fca0d36b
---> d3660e1abc43
Step 9/9 : RUN _GLIBCXX_USE_CXX11_ABI=1 cmake --build .
---> Running in 83f594b672aa
[ 1%] Building CXX object src/tbb/CMakeFiles/tbb.dir/address_waiter.cpp.o
[ 1%] Building CXX object src/tbb/CMakeFiles/tbb.dir/allocator.cpp.o
[ 1%] Building CXX object src/tbb/CMakeFiles/tbb.dir/arena.cpp.o
[ 2%] Building CXX object src/tbb/CMakeFiles/tbb.dir/arena_slot.cpp.o
[ 2%] Building CXX object src/tbb/CMakeFiles/tbb.dir/concurrent_bounded_queue.cpp.o
[ 2%] Building CXX object src/tbb/CMakeFiles/tbb.dir/dynamic_link.cpp.o
[ 3%] Building CXX object src/tbb/CMakeFiles/tbb.dir/exception.cpp.o
[ 3%] Building CXX object src/tbb/CMakeFiles/tbb.dir/governor.cpp.o
[ 3%] Building CXX object src/tbb/CMakeFiles/tbb.dir/global_control.cpp.o
[ 4%] Building CXX object src/tbb/CMakeFiles/tbb.dir/itt_notify.cpp.o
[ 4%] Building CXX object src/tbb/CMakeFiles/tbb.dir/main.cpp.o
[ 4%] Building CXX object src/tbb/CMakeFiles/tbb.dir/market.cpp.o
[ 4%] Building CXX object src/tbb/CMakeFiles/tbb.dir/misc.cpp.o
[ 5%] Building CXX object src/tbb/CMakeFiles/tbb.dir/misc_ex.cpp.o
[ 5%] Building CXX object src/tbb/CMakeFiles/tbb.dir/observer_proxy.cpp.o
[ 5%] Building CXX object src/tbb/CMakeFiles/tbb.dir/parallel_pipeline.cpp.o
[ 6%] Building CXX object src/tbb/CMakeFiles/tbb.dir/private_server.cpp.o
[ 6%] Building CXX object src/tbb/CMakeFiles/tbb.dir/profiling.cpp.o
[ 6%] Building CXX object src/tbb/CMakeFiles/tbb.dir/rml_tbb.cpp.o
[ 7%] Building CXX object src/tbb/CMakeFiles/tbb.dir/rtm_mutex.cpp.o
[ 7%] Building CXX object src/tbb/CMakeFiles/tbb.dir/rtm_rw_mutex.cpp.o
[ 7%] Building CXX object src/tbb/CMakeFiles/tbb.dir/semaphore.cpp.o
[ 8%] Building CXX object src/tbb/CMakeFiles/tbb.dir/small_object_pool.cpp.o
[ 8%] Building CXX object src/tbb/CMakeFiles/tbb.dir/task.cpp.o
[ 8%] Building CXX object src/tbb/CMakeFiles/tbb.dir/task_dispatcher.cpp.o
[ 9%] Building CXX object src/tbb/CMakeFiles/tbb.dir/task_group_context.cpp.o
[ 9%] Building CXX object src/tbb/CMakeFiles/tbb.dir/version.cpp.o
[ 9%] Building CXX object src/tbb/CMakeFiles/tbb.dir/queuing_rw_mutex.cpp.o
[ 10%] Linking CXX shared library ../../gnu_10.2_cxx11_64_relwithdebinfo/libtbb.so
[ 10%] Built target tbb
[ 10%] Building CXX object src/tbbmalloc/CMakeFiles/tbbmalloc.dir/backend.cpp.o
[ 10%] Building CXX object src/tbbmalloc/CMakeFiles/tbbmalloc.dir/backref.cpp.o
[ 11%] Building CXX object src/tbbmalloc/CMakeFiles/tbbmalloc.dir/frontend.cpp.o
[ 11%] Building CXX object src/tbbmalloc/CMakeFiles/tbbmalloc.dir/large_objects.cpp.o
[ 11%] Building CXX object src/tbbmalloc/CMakeFiles/tbbmalloc.dir/tbbmalloc.cpp.o
[ 12%] Building CXX object src/tbbmalloc/CMakeFiles/tbbmalloc.dir/__/tbb/itt_notify.cpp.o
[ 12%] Linking CXX shared library ../../gnu_10.2_cxx11_64_relwithdebinfo/libtbbmalloc.so
[ 12%] Built target tbbmalloc
[ 12%] Building CXX object src/tbbmalloc_proxy/CMakeFiles/tbbmalloc_proxy.dir/function_replacement.cpp.o
[ 13%] Building CXX object src/tbbmalloc_proxy/CMakeFiles/tbbmalloc_proxy.dir/proxy.cpp.o
[ 13%] Linking CXX shared library ../../gnu_10.2_cxx11_64_relwithdebinfo/libtbbmalloc_proxy.so
[ 13%] Built target tbbmalloc_proxy
[ 14%] Building CXX object test/CMakeFiles/test_tick_count.dir/tbb/test_tick_count.cpp.o
[ 14%] Linking CXX executable ../gnu_10.2_cxx11_64_relwithdebinfo/test_tick_count
[ 14%] Built target test_tick_count
[ 14%] Building CXX object test/CMakeFiles/test_allocators.dir/tbb/test_allocators.cpp.o
[ 14%] Linking CXX executable ../gnu_10.2_cxx11_64_relwithdebinfo/test_allocators
[ 14%] Built target test_allocators
[ 14%] Building CXX object test/CMakeFiles/test_arena_priorities.dir/tbb/test_arena_priorities.cpp.o
[ 15%] Linking CXX executable ../gnu_10.2_cxx11_64_relwithdebinfo/test_arena_priorities
[ 15%] Built target test_arena_priorities
[ 15%] Building CXX object test/CMakeFiles/test_dynamic_link.dir/tbb/test_dynamic_link.cpp.o
[ 15%] Linking CXX executable ../gnu_10.2_cxx11_64_relwithdebinfo/test_dynamic_link
[ 15%] Built target test_dynamic_link
[ 16%] Building CXX object test/CMakeFiles/test_concurrent_lru_cache.dir/tbb/test_concurrent_lru_cache.cpp.o
[ 16%] Linking CXX executable ../gnu_10.2_cxx11_64_relwithdebinfo/test_concurrent_lru_cache
[ 16%] Built target test_concurrent_lru_cache
[ 16%] Building CXX object test/CMakeFiles/test_concurrent_unordered_map.dir/tbb/test_concurrent_unordered_map.cpp.o
In file included from /opt/rh/devtoolset-10/root/usr/include/c++/10/string:55,
from /opt/rh/devtoolset-10/root/usr/include/c++/10/bits/locale_classes.h:40,
from /opt/rh/devtoolset-10/root/usr/include/c++/10/bits/ios_base.h:41,
from /opt/rh/devtoolset-10/root/usr/include/c++/10/streambuf:41,
from /opt/rh/devtoolset-10/root/usr/include/c++/10/bits/streambuf_iterator.h:35,
from /opt/rh/devtoolset-10/root/usr/include/c++/10/iterator:66,
from /oneTBB/src/tbb/../../include/tbb/../oneapi/tbb/detail/_template_helpers.h:28,
from /oneTBB/src/tbb/../../include/tbb/../oneapi/tbb/detail/_containers_helpers.h:20,
from /oneTBB/src/tbb/../../include/tbb/../oneapi/tbb/detail/_concurrent_unordered_base.h:25,
from /oneTBB/src/tbb/../../include/tbb/../oneapi/tbb/concurrent_unordered_map.h:21,
from /oneTBB/src/tbb/../../include/tbb/concurrent_unordered_map.h:17,
from /oneTBB/test/tbb/test_concurrent_unordered_map.cpp:22:
/opt/rh/devtoolset-10/root/usr/include/c++/10/bits/basic_string.h: In instantiation of ‘class std::basic_string<char, std::char_traits<char>, tbb::detail::d1::tbb_allocator<char> >’:
/oneTBB/test/common/concurrent_associative_common.h:934:29: required from ‘void test_map_specific_types() [with Checker = UnorderedMapTypesTester]’
/oneTBB/test/tbb/test_concurrent_unordered_map.cpp:97:54: required from here
/opt/rh/devtoolset-10/root/usr/include/c++/10/bits/basic_string.h:3150:57: error: no type named ‘size_type’ in ‘std::basic_string<char, std::char_traits<char>, tbb::detail::d1::tbb_allocator<char> >::_CharT_alloc_type’ {aka ‘std::allocator_traits<tbb::detail::d1::tbb_allocator<char> >::rebind_alloc<char>’}
3150 | typedef typename _CharT_alloc_type::size_type size_type;
| ^~~~~~~~~
compilation terminated due to -Wfatal-errors.
gmake[2]: *** [test/CMakeFiles/test_concurrent_unordered_map.dir/tbb/test_concurrent_unordered_map.cpp.o] Error 1
gmake[1]: *** [test/CMakeFiles/test_concurrent_unordered_map.dir/all] Error 2
gmake: *** [all] Error 2
The command '/bin/sh -c _GLIBCXX_USE_CXX11_ABI=1 cmake --build .' returned a non-zero code: 2
@astrojuanlu, I am not sure that setting the _GLIBCXX_USE_CXX11_ABI environment variable will fix the issue.
I guess it should necessarily be a macro.
It can be defined by
#define _GLIBCXX_USE_CXX11_ABI 1in the code, before including any STL/TBB headers- Adding
-D_GLIBCXX_USE_CXX11_ABI=1into the compilation command - Adding
-D_GLIBCXX_USE_CXX11_ABI=1into theCXXFLAGSenvironment variable. - Modifying the
CMAKE_CXX_FLAGSvariable while runningcmake.
This short reproducer fails to compile with _GLIBCXX_USE_CXX11_ABI set to 0 and compiles successfully with _GLIBCXX_USE_CXX11_ABI = 1.
@kboyarinov I'm not 100 % sure I'm passing the parameters correctly, but this is what I tried now, and I keep getting the same error:
FROM quay.io/pypa/manylinux2014_x86_64:2022-10-25-fbea779
RUN git clone https://github.com/oneapi-src/oneTBB.git
WORKDIR oneTBB
RUN git checkout v2021.3.0
RUN mkdir build
WORKDIR build
ENV CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=1"
RUN cmake .. -DCMAKE_CXX_FLAGS="-D_GLIBCXX_USE_CXX11_ABI=1"
RUN cmake --build .
And I don't know where should I add #define _GLIBCXX_USE_CXX11_ABI 1, since the problem is not on my code calling oneTBB, but on oneTBB itself.
I've run into the same error with 2021.8.0 on manylinux2014
@astrojuanlu is the issue still relevant?
Hi @nofuturre, I am no longer working with oneTBB, but there was never a satisfactory solution to my query. I gave multiple Dockerfiles to reproduce the issue and try to fix it (without success).
Whether or not this issue is still present in recent versions, I'll let someone else do the experiment.
And whether or not this is still relevant, it's up to the maintainers I guess :)