Building OpenCV using Visual Studio 2013 OpenGL CUDA and TBB
Hello everybody and happy new year for those under gregorain calendar!
I have been trying to build OpenCV 2.4.10 on Windows 7 32bit using Visual Studio 2013 and it has been a real pain. Mostly, I think it is my lack of expertice what is making it so difficult. I have make some achivements but unfortunatelly it is not working 100%.
I would like to write a small manual not so focused on the step by step -it can be frustrating when one of those steps fails and you don't know how to reach the next one- and more focused on understanding what is happening on each step, why and what to expect when something goes wrong. I ask for your help, sure you have faced lot of them before and can explain why it is happening. I am downloading 3 to build with CMake 3.0.2 and Visual Studio 2013. I will update this thread as I take steps.
My aim is to build 2.4.10 with CUDA, TBB and OpenGL support. And make it work :)
- Clone OpenCV 2.4.10 (I am using TortoiseGit at C:\OpenCV\src\src)
- Download TBB Compiled (link: TBB WindowsOS)
- Unzip TBB in C:\OpenCV\src\opt\tbb
- Unzip OpenCV source in C:\OpenCV\src dir
- Open CMake and target source dir C:\OpenCV\src and built dir C:\OpenCV\built
- Configure CMake for the first time
- Select Visual Studio 12 2013, Use default native compilers for a configuration Win32
- Select this options:
- Under WITH tab:
- WITH_CUDA (already checked)
- WITH_OPENGL
- WITH_TBB
- And click configure again...
Here, OPENGL libs are found (opengl32 and glu32) and first missing paths appear (TBB_INCLUDE_DIRS), those for TBB_INCLUDE_DIRS, so:
- Point that line to C:\OpenCV\src\opt\tbb\include and click configure again.
After that configuration process, TBB tab appears in red with LIB_DIR and STDDEF_PATH labels pointed to my TBB folder.
- Click configure again to confirm the changes.
This time, there are no tag in red, and everything seems to be fine. I check the output and GUI OpenGL support is set to Yes, and so is Use TBB (ver 4.3 interface 8002) under Other third-party libraries, so
- Click Generate to generate the Visual Studio files
Files are generated, so
Open Visual Studio 2013 and open OpenCV solution at C:\OpenCV\built and wait for it to be ready
Select Debug and then Build Solution (Ctrl+Shift+B) and wait...
First errors happen when it tries to find the core lib, so I re-run CMake for a simple build, without OpenGL, CUDA or TBB.
So, first question is, why is this happening? Should it not build first the core libs and then go ahead with the rest of libs?
I will keep updating as answers come and as I keep on going...
Thanks a lot everybody!
D!
I have re ran CMake without CUDA, OpenGL and TBB and it builds OK. I am trying now, with the libs built, to re build with all the options
Now, the problem is the path given by CMake to find the tbb libs is wrong.
I think that tbb has 2 versions x32 and x64, so you need to be careful! If OpenGL is on 32, I think you shall get the source of TBB and build it on 32 bits too... Or get the OpenGL and glu on x64
Thanks a lot thdarksdfthmn. I am using th ai32 version of TBB. It is just a matter of path: if I correct it when building, it builds OK.
Then that is the problem... Good luck!
Not just that. Once I have everything built, no OpenGL support is available. I will send more info shortly
More problems: in addition to not finding the tbb libs, there are 2 more errors: error: namespace "std" has no member "max" in project opencv_gpu This did not happened before. This solves the problem: http://code.opencv.org/issues/4084
Now, I have a bunch of errors regarding Intellisense. I am having trouble to find any information about it. What is Intellisense?
Have you searched on Wiki? I think that is some other thing over there...
I did, I was thinking about how it affects to building OpenCV