Errors while building OpenCV 3.0.0 with -D BUILD_TBB flag.
Originally, I wanted to compile opencv 3.0.0 with TBB support on my Raspberry pi. However, libtbb-dev is not available on official raspbian repository. So, I decided to compile OpenCV 3.0.0 from the source to with -D BUILD_TBB=ON -D WITH_TBB=ON cmake flags. It threw me following errors.
[ 56%] Building CXX object modules/core/CMakeFiles/opencv_perf_core.dir/perf/perf_abs.cpp.o
[ 58%] Built target opencv_features2d
[ 58%] Building CXX object modules/core/CMakeFiles/opencv_perf_core.dir/perf/perf_main.cpp.o
../../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'
collect2: error: ld returned 1 exit status
So, I decided to compile OpenCV 2.4.9 with the same cmake flags and it worked fine. To see if it's an Rpi problem or -D BUILD_TBB=ON problem, I decided to compile OpenCV 3.0.0 on my ubuntu 15.04 machine with the same cmake configuration and it threw me the same error. What do I need to do to fix this problem ? Has anyone faced the same problem ? I appreciate the help. Thanks.
Update:
I also tried changing tbb source file (in 3rdparty/tbb/CMakeList ...
I am not sure but with TBB it seems that there is two configuation one with dll and another where you build tbb your self I think.
In cmake you have got flag WITH_TBB and and another flag BUILD_TBB. In my configuration I have got only TBB dll so I use with_tbb May be there is same difference on linux
PS I haven't got my configuration so I cannot check which flag I use with TBB DLL on windows 7 opencv 3.0 gold
@LBerger You're correct, ie you can make use of already installed libraries (like you mentioned with dll) or you can build a 3rd party library from source at the time of building OpenCV as per I understand and BUILD_TBB is for later option, ie, building on the go as you compile OpenCV.