Aziuth
Aziuth

Reputation: 3902

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

Currently, I try to compile OpenVDB, which depends on Threading Building Blocks. I get the following error:

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

In short, as second and third argument, the ?: operator gets one base type and the same base type wrapped in tbb::atomic, with the compiler not knowing which type to use as return value.

Needless to say, I have no intentions of changing that source code. Since they are established products, it's safe to say that I do something wrong at compiling.

The TBB library file seems to be build with rather old versions of GCC, that is 4.7. I originally thought that the problem might be that I used GCC 7.2.0, therefore I tried out different versions, like GCC 4.8.5, but the error persists.

I haven't tried out 4.7 in particular since I work in a company where I don't have admin rights, and I try to avoid a local installation of GCC. Especially since I don't know if GCC is even the issue here.

Does anyone know a fix to that?

Edit: https://software.intel.com/en-us/forums/intel-threading-building-blocks/topic/417161 seems to be about the same problem, and an employee from Intel noted it for change in there. However, that post was from 2013 and since people used TBB in-between, there must be something I do different in general.

Upvotes: 1

Views: 787

Answers (1)

Alex
Alex

Reputation: 632

It looks like that an outdated TBB version is used. See the similar question on the TBB forum.

Upvotes: 1

Related Questions