I am trying to install libtbb-dev on my raspberry-pi as part of installing opencv.

sudo apt-get install libtbb-dev

But i am getting an error as

Package libtbb-dev is not available,but is refered to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'libtbb-dev' has no installation candidate. 

Where to get this installed from .

  • Is this required by opencv? Normally installing opencv would automatically pull in its dependencies. I ask in case you are following an incorrect web blog. – joan Aug 20 '14 at 7:58
  • @joan samontab.com/web/2012/06/… – slaveCoder Aug 20 '14 at 8:32
  • You shouldn't really follow a Ubuntu blog. Did you actually try sudo apt-get install libopencv-dev? That should pull in everything you need. – joan Aug 20 '14 at 8:39
  • @joan can u give some tutorial links on this... it wud be of great help.. thankyou.. – slaveCoder Aug 20 '14 at 12:36

I was able to successfully build and test tbb following the thread below:

https://software.intel.com/en-us/forums/topic/500680

I built version tbb43_20150209oss and used the following flags to make:

CXXFLAGS="-DTBB_USE_GCC_BUILTINS=1 -D__TBB_64BIT_ATOMICS=0"

While libtbb is not necessary for RPB1 owners, the Raspberry Pi B 2 has a quadcore processor and compiling opencv with libtbb may be useful to some.

  • Even though, I make use of these flags, it fails to run tests giving out "arm7va" error. – dhruvvyas90 Jun 20 '15 at 8:01

libtbb isn't available on wheezy under armhf but Raspberry Pi version 1 is single core and TBB is unecessary. You can skip over TBB via a cmake option:

-DWITH_TBB:BOOL=FALSE

Raspberry Pi 2 however has four cores and TBB is beneficial. Here are @danielchalef's steps in a bit more detail - substitute the latest tbb version as required:

# Download and unpack
wget https://www.threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb43_20150611oss_src.tgz
tar xvf tbb43_20150611oss_src.tgz
cd tbb43_20150611oss

# Make flags from https://software.intel.com/en-us/forums/topic/500680
make tbb CXXFLAGS="-DTBB_USE_GCC_BUILTINS=1 -D__TBB_64BIT_ATOMICS=0" 

# Export the required environment variables
cd ~/tbb43_20150611oss/build/linux_armv7_gcc_cc4.6_libc2.13_kernel3.18.11_release
source tbbvars.sh

Now you can compile opencv with -DWITH_TBB:BOOL=TRUE.

When face detecting with detectMultiscale I saw a 27% improvement when using TBB at 320x240 resolution

Unless you have a very good reason it is best to install software from an official repository.

You can then be sure that the software has been tested and is consistent with the other packages from that repository.

In the case of opencv you can install from the repositories with the following commands.

sudo apt-get update
sudo apt-get install libopencv-dev

Using the apt-get tool ensures that all the needed dependency packages will also be installed.

Example

sudo apt-get install libopencv-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libavcodec-dev libavformat-dev libavutil-dev libcv-dev libcvaux-dev
  libdc1394-22-dev libgtk2.0-dev libhighgui-dev libilmbase-dev libjasper-dev
  libjbig-dev libjpeg8-dev libopencv-calib3d-dev libopencv-contrib-dev
  libopencv-core-dev libopencv-features2d-dev libopencv-flann-dev
  libopencv-highgui-dev libopencv-imgproc-dev libopencv-legacy-dev
  libopencv-ml-dev libopencv-objdetect-dev libopencv-photo-dev
  libopencv-stitching-dev libopencv-ts-dev libopencv-video-dev
  libopencv-videostab-dev libopenexr-dev libraw1394-dev libraw1394-tools
  libswscale-dev libtiff4-dev libtiffxx0c2 libxml2-utils
Suggested packages:
  libgsm1-dev libogg-dev libschroedinger-dev libspeex-dev libtheora-dev
  libvorbis-dev libgtk2.0-doc libraw1394-doc
The following NEW packages will be installed:
  libavcodec-dev libavformat-dev libavutil-dev libcv-dev libcvaux-dev
  libdc1394-22-dev libgtk2.0-dev libhighgui-dev libilmbase-dev libjasper-dev
  libjbig-dev libjpeg8-dev libopencv-calib3d-dev libopencv-contrib-dev
  libopencv-core-dev libopencv-dev libopencv-features2d-dev
  libopencv-flann-dev libopencv-highgui-dev libopencv-imgproc-dev
  libopencv-legacy-dev libopencv-ml-dev libopencv-objdetect-dev
  libopencv-photo-dev libopencv-stitching-dev libopencv-ts-dev
  libopencv-video-dev libopencv-videostab-dev libopenexr-dev libraw1394-dev
  libraw1394-tools libswscale-dev libtiff4-dev libtiffxx0c2 libxml2-utils
0 upgraded, 35 newly installed, 0 to remove and 0 not upgraded.
Need to get 16.4 MB of archives.
After this operation, 71.8 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
  • If you develop, then the "very good reason" becomes, the official repository is grossly outdated. A check right now for opencv still shows jessie is using the old opencv 2.4 while everyone else is using opencv 3.1. Unfortunately, linux needs a better way to allow users to update software to current versions without building from source and littering your OS with all kinds of software you can't easily remove/upgrade. – kevin Feb 28 '16 at 20:37

use

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_TBB=ON ..

when building opencv

Edit: This works because -D WITH_TBB=ON : tells opencv to build with tbb -D BUILD_TBB=ON : tells opencv to download tbb before build if tbb is not found

I do not know any better explanation but it did the trick for me. Good luck.

  • Why? While this answer may be correct, it doesn't give any indication as to why this would work, or what the OP's problem was. – Jacobm001 Dec 21 '15 at 22:10
  • I had the same problem with OP and I would explain other options if I knew the answer. However I solved my problem after hours of research with a single command line, so I am leaving this to here for other beginners who might benefit of it such as myself. – Özgen Eren Dec 22 '15 at 9:49

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.