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

时间:2017-12-06 11:34:15

标签: c++ tbb

目前,我尝试编译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,所以我必须做一些不同的事情。

1 个答案:

答案 0 :(得分:1)

看起来使用了过时的TBB版本。 请参阅the similar question on the TBB forum