How to install TBB from source on Linux and make it work

Asked
Active3 hr before
Viewed126 times

4 Answers

sourceinstall
90%

I would like to know how to install TBB from source and make it work on a Linux system. I have had some problems when it comes using it, problems that don't appear if I install TBB via the package manager.,NOTE: The library version number when this question was asked was 2 (if I recall correctly). I have personally tested the solution up to version 4.1, but I think it should work too for current version 4.2 (update 3) since the building method remains the same., Worth noting that in Ubuntu 19.10, it all works after one sudo apt install: stackoverflow.com/questions/51031060/… – Ciro Santilli 新疆再教育营六四事件法轮功郝海东 Dec 2 '19 at 21:22 , Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers

  1. Download the latest stable source code and uncompress it, i.e in ~/tbbsrc

  2. Inside, type make. It should start compiling the tbb library and the memory allocators.

  3. The headers are in ~/tbbsrc/include

  4. Inside ~/tbbsrc/build will be two new folders, one for the release version and the other for the debug version. Those folders are named like architecture_ldVersion_g++Version_kernelVersion.

  5. I recommend setting some variables, for example in your ~/.bashrc file, like:

TBB_INSTALL_DIR = $HOME / tbbsrc
TBB_INCLUDE = $TBB_INSTALL_DIR / include
TBB_LIBRARY_RELEASE = $TBB_INSTALL_DIR / build / RELEASE_FOLDER
TBB_LIBRARY_DEBUG = $TBB_INSTALL_DIR / build / DEBUG_FOLDER
  1. Let's try a simple example:
// main.cpp
#include "tbb/task_scheduler_init.h"

int main(int argc, char * argv[]) {
   // tbb::task_scheduler_init init(tbb::task_scheduler_init::automatic);
   // implicit tbb::task_sheduler_init::automatic
   tbb::task_scheduler_init init;
   return 0;
}
  1. To compile, for example, with the release version:
g++main.cpp - I$TBB_INCLUDE - Wl, -rpath, $TBB_LIBRARY_RELEASE - L$TBB_LIBRARY_RELEASE - ltbb
load more v
88%

I would like to know how to install TBB from source and make it work on a Linux system. I have had some problems when it comes using it, problems that don't appear if I install TBB via the package manager.,Inside, type make. It should start compiling the tbb library and the memory allocators.,Inside, type make. It should start compiling the tbb library and the memory allocators. ,So my question is, is there an easy way to setup everything (compile the source code, what variables should I set...) in order to use TBB?

  1. Download the latest stable source code and uncompress it, i.e in ~/tbbsrc

  2. Inside, type make. It should start compiling the tbb library and the memory allocators.

  3. The headers are in ~/tbbsrc/include

  4. Inside ~/tbbsrc/build will be two new folders, one for the release version and the other for the debug version. Those folders are named like architecture_ldVersion_g++Version_kernelVersion.

  5. I recommend setting some variables, for example in your ~/.bashrc file, like:

TBB_INSTALL_DIR = $HOME / tbbsrc
TBB_INCLUDE = $TBB_INSTALL_DIR / include
TBB_LIBRARY_RELEASE = $TBB_INSTALL_DIR / build / RELEASE_FOLDER
TBB_LIBRARY_DEBUG = $TBB_INSTALL_DIR / build / DEBUG_FOLDER
  1. Let's try a simple example:
// main.cpp
#include "tbb/task_scheduler_init.h"

int main(int argc, char * argv[]) {
   // tbb::task_scheduler_init init(tbb::task_scheduler_init::automatic);
   // implicit tbb::task_sheduler_init::automatic
   tbb::task_scheduler_init init;
   return 0;
}
  1. To compile, for example, with the release version:
g++main.cpp - I$TBB_INCLUDE - Wl, -rpath, $TBB_LIBRARY_RELEASE - L$TBB_LIBRARY_RELEASE - ltbb
load more v
72%

Add the Ubuntu repository that contains the latest version 2019~U8-1, run the following command in terminal:,To upgrade to the latest version, please do the following:,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,Upgrade to the latest version, run the following command in terminal:

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
load more v
65%

TBBConfig files are automatically created during the build from source code and can be installed together with the library. Also oneTBB provides a helper function that creates TBBConfig files from predefined templates: see tbb_generate_config in cmake/config_generation.cmake.,MSVC: use switch for generator (e.g. -A Win32 for VS2019) during the configuration stage and then build as usual.,The following controls are available during the configure stage:,The search for a suitable version of the HWLOC library is enabled by default, but if you want to use a specific version of the library, you can specify the path to it manually using the following CMake variables:

TBB_TEST: BOOL - Enable testing(ON by
   default)
TBB_STRICT: BOOL - Treat compiler warnings as errors(ON by
   default)
TBB_SANITIZE: STRING - Sanitizer parameter, passed to compiler / linker
TBB_SIGNTOOL: FILEPATH - Tool
for digital signing, used in post install step
for libraries
if provided.
TBB_SIGNTOOL_ARGS: STRING - Additional arguments
for TBB_SIGNTOOL, used
if TBB_SIGNTOOL is set.
TBB_BUILD: BOOL - Enable Intel(R) oneAPI Threading Building Blocks(oneTBB) build(ON by
   default)
TBBMALLOC_BUILD: BOOL - Enable Intel(R) oneAPI Threading Building Blocks(oneTBB) memory allocator build(ON by
   default)
TBBMALLOC_PROXY_BUILD: BOOL - Enable Intel(R) oneAPI Threading Building Blocks(oneTBB) memory allocator proxy build(requires TBBMALLOC_BUILD.ON by
   default)
TBB4PY_BUILD: BOOL - Enable Intel(R) oneAPI Threading Building Blocks(oneTBB) Python module build(OFF by
   default)
TBB_CPF: BOOL - Enable preview features of the library(OFF by
   default)
TBB_INSTALL_VARS: BOOL - Enable auto - generated vars installation(packages generated by `cpack`
   and `make install`
   will also include the vars script)(OFF by
   default)
TBB_VALGRIND_MEMCHECK: BOOL - Enable scan
for memory leaks using Valgrind(OFF by
   default)
TBB_DISABLE_HWLOC_AUTOMATIC_SEARCH - Disable HWLOC automatic search by pkg - config tool(OFF by
   default)
TBB_ENABLE_IPO - Enable Interprocedural Optimization(IPO) during the compilation(ON by
   default)
load more v

Other "source-install" queries related to "How to install TBB from source on Linux and make it work"