OpenCV 3.0 - investigate crash in release mode [closed]
Hello!
I work on an application that uses many OpenCV functions and I'm trying to make the transition to 3.0 since it's been released. I downloaded it from here: http://sourceforge.net/projects/openc... (I use VS2013.) Since 3.0 is mostly compatible with 2.x code, within a short time, I got a compiling code.
The strange thing is that it crashes in 64 bit in release mode: Unhandled exception at 0x000007FED0483430 (opencv_world300.dll) in XDesktopDev.exe: 0xC0000005: Access violation reading location 0x0000000000000048.
It happens here in my code on a line where Kalman filter is used (presumably within the predict() function?): Mat prediction = kalmanFilter.predict();
So I tried to debug the issue by running it in debug mode, but strangely, it doesn't crash in debug mode. I found this to be quite interesting since debug mode usually has additional asserts so I expected I could reproduce it in debug mode.
The next thing I tried to get additional information about the crash is I built OpenCV using cmake (so I get the pdb files needed for debug info). I used the source files from from the same package that I used for the binaries (linked above). I used mostly the default options for building, what I modified is that I selected to build opencv_world, because that's what is distributed in the OpenCV binaries (build\x64\vc12\lib) and that's what I used when the crash happened. And here comes the strange part: with my build, the crash doesn't happen (in the same 64 bit, release mode configuration). With that, I've pretty much ran out of ideas about how to investigate this crash. The only thing I can think of now is that maybe prebuilt binaries were built with different options (additional optimizations turned on?) that were off for me, but then again, I don't know what exact options were used for the prebuilt libs - is this information available anywhere?
BTW I also tried to run it in 32 bit, and it also doesn't crash that way, not in release, nor in debug mode.
So it looks like, this crash in only happening in 64 bit, only in release mode, only with the prebuilt libs. And I found no way how to investigate it further. Any tips?
Thanks
To be short, if you want a working build without problems, build on your own system. It can be due to hardware differences, OS differences, configuration settings, ... I never get problems if I build OpenCV on the system that it is going to run on.
Thanks for the answer. Well, I guess that's one way to look at it, but that can be quite inconvenient if you want to distribute an application with OpenCV. I mean, you can't expect everyone to build OpenCV, there's a reason prebuilt libraries are available and I never had such issue with them. I don't think this is normal, it rather feels like a bug that should be fixed somewhere... I just can't get around it.
Hmm if you want to redistribute an application with OpenCV included than you use a statically linked library and not a dynamically linked one. Than you will also build OS specific versions of your app. Prebuilt libs in OpenCV are not static, they are dynamically loaded and thus these problems occurs sometimes.
Yeah that's true you usually want statically linked library for distributed apps where stability is a major concern (though I see scenarios where dynamic linking would be practical so OpenCV could be updated without having to recompile the app or do anything with it), and this application is not really at that stage yet, it was just an example. Nevertheless dynamically linked libs should work too... If I could find out where the error comes from I could at least post a bug report.
so OpenCV could be updated without having to recompile the app ... from my experience this will fail several times over. Somehow it always manages to get broken in the pipeline. Keep the search going, will have a look at code also, so we might be able to report the bug if it is there.