boostorg / unordered

Boost.org unordered module
http://boost.org/libs/unordered
Boost Software License 1.0
62 stars 55 forks source link

Boost requires TBB? #222

Closed Baksling closed 1 month ago

Baksling commented 8 months ago

When installing version 1.83.0 and including <boost/unordered/concurrent_flat_map.h>, i get an error that there is an undefined reference to TBB oneapi aka:

/usr/bin/ld: tests/CMakeFiles/parser.dir/parser_test.cpp.o: in function tbb::detail::d1::execution_slot(tbb::detail::d1::execution_data const&)': /usr/include/oneapi/tbb/detail/_task.h:169: undefined reference totbb::detail::r1::execution_slot(tbb::detail::d1::execution_data const)' /usr/bin/ld: tests/CMakeFiles/parser.dir/parser_test.cpp.o: in function tbb::detail::d1::current_thread_index()': /usr/include/oneapi/tbb/task_arena.h:454: undefined reference totbb::detail::r1::execution_slot(tbb::detail::d1::execution_data const)'

I am unable to find in the documentation that concurrent_flat_map relies on TBB, but i might be missing some build options? I am using the following command to download and install boost to my project, where i rely on the program_options and test:

ExternalProject_Add( boost-ext URL https://boostorg.jfrog.io/artifactory/main/release/1.83.0/source/boost_1_83_0.zip URL_HASH SHA256=c86bd9d9eef795b4b0d3802279419fde5221922805b073b9bd822edecb1ca28e PATCH_COMMAND echo "${BOOST_CONFIG_JAM}" $ > config.jam CONFIGURE_COMMAND ./bootstrap.sh --with-toolset=${BOOST_TOOLSET} --prefix=${CMAKE_BINARY_DIR}/external cxxflags="-arch x86_64" --without-icu BUILD_COMMAND ./b2 --user-config=config.jam --prefix=${EXTERNAL_INSTALL_LOCATION} --with-test --with-program_options cxxstd=17 cflags="-fPIC" cxxflags="-fPIC" address-model=64 ${BOOST_B2_OPTS} variant=release link=shared runtime-link=shared install BUILD_IN_SOURCE 1 INSTALL_COMMAND "" )

Am i missing an option or component for concurrent_flat_map? I have tried adding --with-containers and --with-unordered, but the issues remain
pdimov commented 8 months ago

What compiler and platform is this?

pdimov commented 8 months ago

Some versions of GCC (e.g. GCC 9) implement the standard <execution> header on top of TBB.

https://godbolt.org/z/PvKo5KEzc

If that's your issue, you can try to define BOOST_UNORDERED_DISABLE_PARALLEL_ALGORITHMS and see if it helps.

https://github.com/boostorg/unordered/blob/f493603f5cd2bd090be440cacfcaa95f2566059b/include/boost/unordered/detail/foa/concurrent_table.hpp#L41