Install newest tbb (thread building-blocks) on Ubuntu 18.04

I'm trying to get C++17 parallel execution policies to work on Ubuntu 18.04. I have gcc 9, which supports them, and I got tbb installed via

$ sudo apt install libtbb-dev

But now I get the complaint:

/usr/include/c++/9/pstl/parallel_backend_tbb.h:28:2: error: #error Intel(R) Threading Building Blocks 2018 is required; older versions are not supported.
   28 | #error Intel(R) Threading Building Blocks 2018 is required; older versions are not supported.
      |  ^~~~~
compilation terminated due to -Wfatal-errors.

Is it possible to get TBB 2018 or newer via apt?


Solution 1:

To upgrade to the latest version, please do the following:

  1. Add the Ubuntu repository that contains the latest version 2019~U8-1, run the following command in terminal:

    echo "deb http://cz.archive.ubuntu.com/ubuntu eoan main universe" | sudo tee -a /etc/apt/sources.list

  2. Update the repositories, run the following command in terminal:

    sudo apt update

  3. Upgrade to the latest version, run the following command in terminal:

    sudo apt install libtbb-dev

After this you should have the latest libtbb-dev installed.


CAUTION:

One of the most common problems we help untangle is folks who have mixed sources from different releases of Ubuntu and broke their system, so we usually don't recommend it. Folks who want newer software should use a newer release of Ubuntu instead. It is strongly advised to just upgrade the needed package and remove the repository added above, once you have successfully upgraded the needed package. This can be done by editing the /etc/apt/sources.list file and commenting out or removing that line deb http://cz.archive.ubuntu.com/ubuntu eoan main universe and running sudo apt update afterwards.


NOTICE:

To know which official Ubuntu repository contains the latest version of a certain package, you can search for it at Ubuntu packages.

Solution 2:

I used (as a workaround) the official releases from Intel's github page.