[oneTBB]:未定义对 tbb::d etail::r1::xxxxx 的引用 #802

[oneTBB]: undefined reference to tbb::detail::r1::xxxxx #802

提问人:user5570258 提问时间:3/9/2022 更新时间:3/9/2022 访问量:918

问:

用法:

ExternalProject_Add(tbb
    PREFIX ${CMAKE_SOURCE_DIR}/deps
    DOWNLOAD_NO_PROGRESS 1
    DOWNLOAD_NAME v2021.4.0
    # TODO: add wb cdn link
    URL https://codeload.github.com/oneapi-src/oneTBB/tar.gz/refs/tags/v2021.4.0
    URL_HASH SHA1=2641f9a1ead4621a8660ee07a1664627fa0eb477
    BUILD_IN_SOURCE 1
    LOG_CONFIGURE 1
    LOG_BUILD 1
    LOG_INSTALL 1
    CMAKE_COMMAND ${CMAKE_COMMAND}
    CMAKE_ARGS 
        -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> 
        -DBUILD_SHARED_LIBS=OFF 
        -DTBB_TEST=OFF 
        -DTBB_EXAMPLES=OFF 
        -DTBB_BENCH=OFF
    #CONFIGURE_COMMAND ""
    BUILD_COMMAND make extra_inc=big_iron.inc ${ENABLE_STD_LIB}
    INSTALL_COMMAND bash -c "/bin/cp -f */libtbb.${TBB_LIB_SUFFIX}* ${CMAKE_SOURCE_DIR}/deps/lib/"
    BUILD_BYPRODUCTS ${CMAKE_SOURCE_DIR}/deps/lib/libtbb.${TBB_LIB_SUFFIX}
)

通向

/home/runner/work/deps/src/tbb/include/tbb/../oneapi/tbb/task_group.h:271: error: undefined reference to 'tbb::detail::r1::initialize(tbb::detail::d1::task_group_context&)'
/home/runner/work/deps/src/tbb/include/tbb/../oneapi/tbb/detail/_small_object_pool.h:61: error: undefined reference to 'tbb::detail::r1::allocate(tbb::detail::d1::small_object_pool*&, unsigned long)'
/home/runner/work/deps/src/tbb/include/tbb/../oneapi/tbb/task_arena.h:466: error: undefined reference to 'tbb::detail::r1::max_concurrency(tbb::detail::d1::task_arena_base const*)'
/home/runner/work/deps/src/tbb/include/tbb/../oneapi/tbb/detail/_task.h:191: error: undefined reference to 'tbb::detail::r1::execute_and_wait(tbb::detail::d1::task&, tbb::detail::d1::task_group_context&, tbb::detail::d1::wait_context&, tbb::detail::d1::task_group_context&)'
/home/runner/work/deps/src/tbb/include/tbb/../oneapi/tbb/task_group.h:367: error: undefined reference to 'tbb::detail::r1::destroy(tbb::detail::d1::task_group_context&)'
/home/runner/work/deps/src/tbb/include/tbb/../oneapi/tbb/task_group.h:367: error: undefined reference to 'tbb::detail::r1::destroy(tbb::detail::d1::task_group_context&)'

在 mac OS 中,它运行良好,但 centos 7.2(gcc 7.2) 和 ubuntu(clang 6) 会导致错误。 有人可以帮忙吗??

C++ 未定义引用 TBB

评论

2赞 Ken White 3/9/2022
这回答了你的问题吗?什么是未定义的引用/未解析的外部符号错误,如何解决?

答: 暂无答案