How to install opencv with tbb enabled using mingw
Asked Answered
S

1

6

How to install Opencv with TBB enabled?

I tried the following:

1) Downloaded the TBB package.

2) Build using the below command

 mingw32-make compiler=gcc arch=ia32 runtime=mingw default

3) I set the Environmental variable path as "d:\tbb\build\windows_ia32_gcc_mingw_release

3) Now using cmake, I enabled "WITH_TBB" and compiled the opencv.

its throwing the below error.

[ 22%] Built target pch_Generate_opencv_core
Linking CXX shared library ..\..\bin\libopencv_core245.dll
c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot fin
d -ltbb
collect2: ld returned 1 exit status
make[2]: *** [bin/libopencv_core245.dll] Error 1
make[1]: *** [modules/core/CMakeFiles/opencv_core.dir/all] Error 2
make: *** [all] Error 2

Am I missing anything... Please advice..

Solar answered 27/5, 2013 at 6:27 Comment(7)
I am trying to do the same, you got much further than I did! Where did you find the documentation? If I get to your same point I will do my best to help :)Katakana
@Katakana I couldnt find any Docs. I solved the problem by setting the TBB bin directory to PATH.Solar
@Katakana I couldnt find time to make a doc on it.. If you tell what problem you are facing, I amy help you..Solar
I can build tbb separately, but I cannot prevent opencv (2.4.5) to download its own tbb package when I run cmake with TBB enabled. Then opencv tries to build tbb, but fails. I cannot configure opencv to use the tbb version I downloaded and built.Katakana
@Katakana Please tell me how you are building. If you are using CMAKE disable "BUILD_TBB" option and enable "WITH_TBB".Solar
Of course, you are right, it was so obvious!! I was generically advised "activate any TBB flag" and then I did and turned off the brain :P Now I disabled BUILD_TBB and I am getting your same error...Katakana
let us continue this discussion in chatSolar
K
11

I had the same problem, the following worked out for removing the tbb linking error:

(Assuming you have already built tbb, as you are already explaining in your question)

  • From CMake, configure one time OpenCV

  • Enable WITH_TBB, be careful not enabling BUILD_TBB: the automatic downloading and building of OpenCV failed miserably for me despite many efforts. If you had previously enabled BUILD_TBB, my suggestion is to restart from the beginnning, clearing cmake cache.

  • Configure a second time OpenCV

  • Now some variables should appear: TBB_INCLUDE_DIRS. For me I set the following values (respectively):

    tbb41_20130314oss/include

  • 2 new variables appears: TBB_STDDEF_PATH and TBB_LIB_DIR. They are assigned some apparently reasonable values. For me, TBB_STDDEF_PATH was correct, but TBB_LIB_DIR was not! So I corrected it to be:

    tbb41_20130314oss/build/windows_ia32_gcc_mingw4.8.1_release

    and I left TBB_STDDEF_PATH as it was:

    tbb41_20130314oss/include/tbb/tbb_stddef.h

  • Configure a third time

  • Finally, click Generate, and you are ready to build mingw32-make -j7

  • Once you start using the opencv library, make sue the tbb DLLs are in your path

Katakana answered 24/6, 2013 at 6:55 Comment(1)
I now realize I did some mess on explaining how many variables appear after the second configure. But I don't have a quick way to try it again. If anybody tries this guide and see again what should be done exactly, please feel free to edit.Katakana

© 2022 - 2024 — McMap. All rights reserved.