Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenCV VS 2010 C++ CMake

Tags:

c++

opencv

cmake

I couldn't find the answer to this probably simple question. I have been having problems getting OpenCV to work on my computer with either Dev C++ or VS 2010.

My question is not about the specifics but instead is about what CMake contributes to the process.

I have worked my way through a lot of C++ programs, learning the language. However, I wrote them and compiled them, no fuss, directly on Dev C++ using the standard includes, etc..

Now wehn I come to try to use my first 3rd party set of libraries, there is this huge process of downloading an executable, using CMake, then compiling with one of the IDEs. To me, there is no wonder the thing goes wrong. Too many steps and for what purpose?

Ok, so I am naive and simple about programming. So here are my questions:

Why is there an executable if you have to do three steps afterwards? I sort of understand if the writers have no idea what compiler everyone is using; but why not just a simple set of source codes and be done with it?

However, if there is a specific file for VS 2010, why not just have it set itself up exactly the way it will work on the computer?, the same way that everyone downloads VS 2010 in the same format and then it installs itself?

Finally, even if some sort of installer is needed to create directory structure (which I still don't understand since Zip, tar, etc. work fine), why is there a need for CMake at all?

I don't mind being laughed at for being stupid and missing some obvious points, but I would appreciate not having to wade through quick retorts: it may seem simple to y'all but from the outside, it doesn't make much sense. Thanks in advance, john


Thanks. I guess I don't understand enough about the details of the process to understand why this is necessary. Or rather, I sort of understand: there are different operating systems and different compilers, but even though the coding is different for each, CMake understands the compilers that it has listed and so a developer only need figure out how to write for CMake. If CMake doesn't understand the environment or compiler, the library authors or the developer has to figure out how to port it to that particular environment. However, I still don't understand why for the case of VS 2010, since OpenCV already has a particular compiler in mind, that CMake is necessary. However, I will just leave that alone for the moment and move on.

Thanks again.


I think I need to add a comment. In response to the question "Is it really that much of an issue?" I think the answer has to be yes. I have wasted almost a week trying to get OpenCV to work with VS 2010.

No one, from the microsoft websites to the independent blogs has been able to help me. I have gone through sxstrace, etc. and tried everything anyone has suggested. In the end it is the same problem.

So yes it really is an issue. i am not trying to learn windows programming at this moment. Nor do i want to learn CMake intricacies at this time. The .exe programs that install for windows have always worked for me. I am sure there are exceptions but personally there aren't. So if OpenCV is putting out a special 2008.exe version, why not just make it work all the way.


By the way, here is the output of the sxstrace text file:

Inizio generazione contesto di attivazione. Parametro di input: Flags = 0 ProcessorArchitecture = x86 CultureFallBacks = it-IT;it ManifestPath = C:\Windows\system32\cxcore210d.dll AssemblyDirectory = C:\Windows\system32\ Application Config File =

INFORMAZIONI: analisi del file manifesto C:\Windows\system32\cxcore210d.dll in corso. INFORMAZIONI: l'identità di definizione del manifesto è (null). INFORMAZIONI: riferimento: Microsoft.VC90.DebugCRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8" INFORMAZIONI: risoluzione del riferimento Microsoft.VC90.DebugCRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8" in corso. INFORMAZIONI: risoluzione del riferimento per ProcessorArchitecture x86 in corso. INFORMAZIONI: risoluzione del riferimento per la lingua Neutral in corso. INFORMAZIONI: applicazione dei criteri di binding in corso. INFORMAZIONI: criteri di autore non trovati. INFORMAZIONI: reindirizzamento criteri di binding non trovato. INFORMAZIONI: inizio dell'esecuzione del probe dell'assembly. INFORMAZIONI: assembly non trovato in WinSxS. INFORMAZIONI: tentativo di esecuzione del probe del manifesto in C:\Windows\assembly\GAC_32\Microsoft.VC90.DebugCRT\9.0.21022.8__1fc8b3b9a1e18e3b\Microsoft.VC90.DebugCRT.DLL. INFORMAZIONI: tentativo di esecuzione del probe del manifesto in C:\Windows\system32\Microsoft.VC90.DebugCRT.DLL. INFORMAZIONI: tentativo di esecuzione del probe del manifesto in C:\Windows\system32\Microsoft.VC90.DebugCRT.MANIFEST. INFORMAZIONI: tentativo di esecuzione del probe del manifesto in C:\Windows\system32\Microsoft.VC90.DebugCRT\Microsoft.VC90.DebugCRT.DLL. INFORMAZIONI: tentativo di esecuzione del probe del manifesto in C:\Windows\system32\Microsoft.VC90.DebugCRT\Microsoft.VC90.DebugCRT.MANIFEST. INFORMAZIONI: manifesto non trovato per la lingua Neutral. INFORMAZIONI: fine dell'esecuzione del probe dell'assembly. INFORMAZIONI: impossibile risolvere il riferimento Microsoft.VC90.DebugCRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8". ERRORE: generazione del contesto di attivazione non riuscita. Fine generazione contesto di attivazione.

Here is the debug output.

'Hello Saturday Night.exe': Loaded 'C:\Users\jake\Documents\Visual Studio 2010\Projects\Hello Saturday Night\Debug\Hello Saturday Night.exe', Symbols loaded. 'Hello Saturday Night.exe': Loaded 'C:\Windows\System32\ntdll.dll', Symbols loaded (source information stripped). 'Hello Saturday Night.exe': Loaded 'C:\Windows\System32\kernel32.dll', Symbols loaded (source information stripped). 'Hello Saturday Night.exe': Loaded 'C:\Windows\System32\cxcore210d.dll', Cannot find or open the PDB file Debugger:: An unhandled non-continuable exception was thrown during process load The thread 'Win32 Thread' (0x1140) has exited with code -1072365566 (0xc0150002). The thread 'Win32 Thread' (0xf1c) has exited with code -1072365566 (0xc0150002). The program '[3688] Hello Saturday Night.exe: Native' has exited with code -1072365566 (0xc0150002).

like image 777
john Avatar asked Nov 15 '10 16:11

john


1 Answers

I think you might misunderstand who CMake benefits the most. It's the library authors, and for good reason. When you are authoring a cross-platform library, you need to provide build environments for the different operating systems and compilers. There are quite a few combinations. Maintaining these make-files and projects/solutions for large library projects is a labour-intensive task, especially if a new file has been added or removed.

CMake takes the pain out of this. It generates a build in a compiler-independent-manner, allowing the authors of the source code to maintain a single build environment. Now the project can be distributed across platforms and compilers easily.

So yes, it's an extra step for the developer using the library, but you only have to build it once-per-release, is it really that much of an issue?

like image 51
Moo-Juice Avatar answered Sep 26 '22 01:09

Moo-Juice