Compliling OpenCV 3 with TBB on Raspberry Pi 2

1.4k views Asked by At

Has anyone successfully installed opencv 3.0.0 with TBB enabled on the latest rasperian on pi 2?

I followed the guide here https://www.raspberrypi.org/forums/view ... v3#p761255

The only differences I made was to the enable TBB via cmake... added BUILD and WITH TBB options as shown..

cmake -D CMAKE_BUILD_TYPE=RELEASE -D BUILD_TBB=ON -D WITH_TBB=ON -D CMAKE_INSTALL_PREFIX=$(python3 -c "import sys; print(sys.prefix)") -D PYTHON_EXECUTABLE=$(which python3) ..

I am patched current, all dependencies installed as far as I can tell.. cmake reports its going to install and old version of tbb...

-- Use TBB: YES (ver 4.1 interface 6102)

The make process fails with a linking problem I don't understand fully,

[ 66%] Built target opencv_features2d
Scanning dependencies of target opencv_test_flann
../../lib/libopencv_imgproc.so.3.0.0: undefined reference to `tbb::task_group_context::cancel_group_execution()'
../../lib/libopencv_imgproc.so.3.0.0: undefined reference to `tbb::interface5::internal::task_base::destroy(tbb::task&)'
../../lib/libopencv_core.so.3.0.0: undefined reference to `tbb::task_scheduler_init::initialize(int)'
../../lib/libopencv_core.so.3.0.0: undefined reference to `tbb::task::note_affinity(unsigned short)'
../../lib/libopencv_imgproc.so.3.0.0: undefined reference to `tbb::internal::handle_perror(int, char const*)'
../../lib/libopencv_core.so.3.0.0: undefined reference to `tbb::internal::allocate_child_proxy::allocate(unsigned int) const'
../../lib/libopencv_imgproc.so.3.0.0: undefined reference to `tbb::internal::NFS_Free(void*)'
../../lib/libopencv_core.so.3.0.0: undefined reference to `tbb::task_group_context::is_group_execution_cancelled() const'
../../lib/libopencv_imgproc.so.3.0.0: undefined reference to `tbb::internal::throw_exception_v4(tbb::internal::exception_id)'
../../lib/libopencv_core.so.3.0.0: undefined reference to `tbb::task_scheduler_init::terminate()'
../../lib/libopencv_core.so.3.0.0: undefined reference to `tbb::task_scheduler_init::initialize(int, unsigned int)'
../../lib/libopencv_core.so.3.0.0: undefined reference to `typeinfo for tbb::task'
../../lib/libopencv_imgproc.so.3.0.0: undefined reference to `tbb::internal::allocate_additional_child_of_proxy::allocate(unsigned int) const'
../../lib/libopencv_imgproc.so.3.0.0: undefined reference to `tbb::task_group_context::reset()'
../../lib/libopencv_core.so.3.0.0: undefined reference to `tbb::internal::allocate_continuation_proxy::allocate(unsigned int) const'
../../lib/libopencv_core.so.3.0.0: undefined reference to `vtable for tbb::task'
../../lib/libopencv_core.so.3.0.0: undefined reference to `tbb::internal::allocate_root_with_context_proxy::free(tbb::task&) const'
../../lib/libopencv_core.so.3.0.0: undefined reference to `tbb::task_group_context::init()'
../../lib/libopencv_imgproc.so.3.0.0: undefined reference to `tbb::internal::NFS_Allocate(unsigned int, unsigned int, void*)'
../../lib/libopencv_core.so.3.0.0: undefined reference to `tbb::task_scheduler_init::default_num_threads()'
../../lib/libopencv_core.so.3.0.0: undefined reference to `tbb::internal::get_initial_auto_partitioner_divisor()'
../../lib/libopencv_core.so.3.0.0: undefined reference to `tbb::task_group_context::~task_group_context()'
../../lib/libopencv_core.so.3.0.0: undefined reference to `tbb::internal::allocate_root_with_context_proxy::allocate(unsigned int) const'
[ 66%] Building CXX object modules/core/CMakeFiles/opencv_perf_core.dir/perf/perf_abs.cpp.o
collect2: ld returned 1 exit status
apps/annotation/CMakeFiles/opencv_annotation.dir/build.make:99: recipe for target 'bin/opencv_annotation' failed
make[2]: *** [bin/opencv_annotation] Error 1
CMakeFiles/Makefile2:7228: recipe for target 'apps/annotation/CMakeFiles/opencv_annotation.dir/all' failed
make[1]: *** [apps/annotation/CMakeFiles/opencv_annotation.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

Things I've tried...

  1. I thought a newer version of TBB may help... so after failing as shown above I hacked the opencv installer and changed the TBB load to the latest release... no joy.. same problem.
  2. Trying to make it finish I found I could update the cmakelists.txt in the opencv/apps folder not install the annotation app.. Still failed. but on a different app.. traincascade... removed it.. same... remove the last app in the directory from CmakeLists.txt and it succeeded. However when attempting to link my c app it complains with the unresolved references on imgproc :|
  3. Ran ccmake ../ and turned of build tests and other extras... no joy.

Appreciate any help I can .. want tbb to use the four cores for my pi if i can!

1

There are 1 answers

0
abhiTronix On

Latest update August 2018,

Check out my git: https://github.com/abhiTronix/OpenCV_Raspberry_pi_TBB

Latest pre-compiled binary of Pre-released OpenCV (4.0.0) & Stable OpenCV (3.4.2) along with TBB (2018-Update 4) for the Raspberry Pi (Tested on Rpi version 2/3 Model B/B+ with Stretch) easy install (.deb file)

It is built by me from scratch, you can check it for more detailed information.