使用英特尔线程构建块编译:错误操作数为?:

Compiling with Intel Threading Building Blocks: error operands to ?:

本文关键字:错误 操作数 编译 英特尔 线程 构建      更新时间:2023-10-16

当前,我尝试编译OpenVDB,这取决于螺纹构建块。我收到以下错误:

In file included from /usr/include/tbb/enumerable_thread_specific.h:32:0,
             from ../openvdb/tools/Morphology.h:59,
             from ../openvdb/tools/MultiResGrid.h:64,
             from cmd/openvdb_lod/main.cc:32:
/usr/include/tbb/concurrent_vector.h: In member function ‘tbb::concurrent_vector<T, A>::iterator tbb::concurrent_vector<T, A>::grow_by(tbb::concurrent_vector<T, A>::size_type)’:
/usr/include/tbb/concurrent_vector.h:667:38: error: operands to ?: have different types ‘tbb::internal::concurrent_vector_base_v3::size_type {aka long unsigned int}’ and ‘tbb::atomic<long unsigned int>’
     return iterator(*this, delta ? internal_grow_by( delta, sizeof(T), &initialize_array, NULL ) : my_early_size);
                            ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/tbb/concurrent_vector.h:667:38: note:   and each type can be converted to the other
/usr/include/tbb/concurrent_vector.h: In member function ‘tbb::concurrent_vector<T, A>::iterator tbb::concurrent_vector<T, A>::grow_by(tbb::concurrent_vector<T, A>::size_type, tbb::concurrent_vector<T, A>::const_reference)’:
/usr/include/tbb/concurrent_vector.h:680:38: error: operands to ?: have different types ‘tbb::internal::concurrent_vector_base_v3::size_type {aka long unsigned int}’ and ‘tbb::atomic<long unsigned int>’
     return iterator(*this, delta ? internal_grow_by( delta, sizeof(T), &initialize_array_by, static_cast<const void*>(&t) ) : my_early_size);
                            ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/tbb/concurrent_vector.h:680:38: note:   and each type can be converted to the other
make: *** [vdb_lod] Error 1

简而言之,作为第二和第三个参数,操作员获得了一种基本类型,并且包裹在tbb::atomic中的相同基本类型,而编译器不知道将哪种类型用作返回值。

不必说,我无意更改该源代码。由于它们是建立的产品,因此可以肯定地说我在编译时做错了什么。

TBB库文件似乎是使用GCC的旧版本构建的,即4.7。我最初认为问题可能是我使用了GCC 7.2.0,因此我尝试了不同版本,例如GCC 4.8.5,但错误仍然存在。

我没有特别尝试过4.7,因为我在没有管理员权利的公司工作,并且试图避免在本地安装GCC。特别是因为我不知道GCC是否在这里是问题。

有人知道解决这个问题吗?

编辑:https://software.intel.com/en-us/forums/intel-threading-building-blocks/topic/417161似乎与同一问题有关那里。但是,该帖子是从2013年开始的,由于人们在之间使用了TBB,因此一般而言,我一定会做一些与众不同的事情。

看起来使用过时的TBB版本。请参阅TBB论坛上的类似问题。

相关文章: