8

In my project on a Ubuntu 20 platform (with g++ 9.3.0), I use the following line

#include <execution>

to support parallel processing via standard library functions. I don't include anything from TBB, the parallel execution library from Intel. But then when I build the program I get the message:

/usr/bin/ld: CMakeFiles/probis.dir/src/probis.cpp.o: in function `tbb::interface7::task_arena::current_thread_index()':
/usr/include/tbb/task_arena.h:449: undefined reference to `tbb::interface7::internal::task_arena_base::internal_current_slot()'

This is easy enough to solve (as in: make the message go away) by adding -ltbb to the linker line. But then I have a dependency on libtbb that I did not count on.

Is this dependency expected? Is it possible to use parallel execution without installing tbb (but that tbb overrides the default setting when it is installed)?

Jérôme Richard
  • 41,678
  • 6
  • 29
  • 59
alle_meije
  • 2,424
  • 1
  • 19
  • 40
  • 3
    gcc/libstdc++ implements execution language facilities in terms of libtbb. It is required in order to use this header. – n. m. could be an AI Apr 20 '21 at 10:44
  • 1
    Ah OK, that clears it up, thanks! So when you install the latest g++ in Linux, TBB is always also installed? Would you mind typing it as an anser, then I'll mark it "solved". It seems others were looking for this too. – alle_meije Apr 21 '21 at 07:17

1 Answers1

4

As @[n. 'pronouns' m.] rightly said, you may need libtbb in order to make your code work. You can download the Intel® oneAPI Base Toolkit which contains TBB as one of the components. Link to download Intel® oneAPI Base Toolkit: https://software.intel.com/content/www/us/en/develop/tools/oneapi/base-toolkit/download.html

  • 1
    ? You can just use the libtbb-dev package for your distro. No need to install some external toolkit. – JHBonarius May 07 '21 at 05:13
  • Thanks! In fact that's what I've been doing. My question was not how to get it to work (very easy with APT) but whether this is the only way / does GNU have an alternative. – alle_meije May 07 '21 at 10:59