Ask Your Question
0

OpenCV Crash C000001D - Severe problem with a solution proposal

asked 2014-06-15 15:10:07 -0600

Robby gravatar image

Hello

I built OpenCV with CMake for Visual Studio letting all the settings (checkboxes) in CMake at its default.

I wrote a small test application and at the first look all worked fine.

But then I compiled as release and the same application crashed. The Crash happened when loading opencv_core248.dll into my process. Error code: 0xC000001D. This happened on my Windows XP computer.

Then I tested on another computer with Windows 7 and - really surprisingly - both work fine: The debug and the release version!

Windows XP, release -> Crash

Windows XP, debug -> OK

Windows 7, release -> OK

Windows 7, debug -> OK

As Visual Studio gave me no clue what was wrong, I ran Dependency Walker which told me that all dependencies were OK. Then I ran ProcessMonitor to see if any error happened while loading the DLL, but all was fine. So what is wrong??

To ever find a crash if the debug version is fine but the release version crashes you must be an experienced programmer! There is no way to single step through the C++ code because the DLL did not even load into the process!

So finally I started my program in OllyDebug which stopped at this command:

MOVQ .... ,MMX0

Invalid instruction.

This happened in line 4860 in persistence.cpp:

*info = *_info;

where info is a CvTypeInfo struct. Visual Studio inserts MMX instructions to copy the content of one struct to another!!! And this happens while the DLL is initializing and results in a crash.

My AMD Sempron processor on my Windwos XP did not understand this instruction.

It is a severe design error that the default settings used for CMake insert instructions that may result in a crash on some processors!!

Several projects are based on OpenCV like for example the Sikuli project. When you download the Sikuli project and run it on an AMD Sempron it will crash for the same reason: It is wrongly compiled, too.

The default configuration for CMake generates VCPROJ files with

Enable Enhanced Instruction Set = Streaming SIMD extensions 2 (/arch:SSE2)

under C/C++ -> Code generation in the project settings.

After turning this off in all projects and compiling the whole world anew, all worked fine.

How is it possible that the default options of OpenCV enable code that is not compatible with all processors??

This is a severe misconfiguration that must be changed urgently in future OpenCV versions.

The SSE instructions must be turned off by default. And anyone who enables this feature must be warned that the code will not run on all processors and may result in a total crash that is nearly impossible to find for beginners.

edit retag flag offensive close merge delete

Comments

I have not run OpenCV on XP, but it may be because of the wrong dlls? Are you sure it is loading the *d.dll files?

thdrksdfthmn gravatar imagethdrksdfthmn ( 2014-06-25 05:14:19 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-03-21 07:39:43 -0600

Robby gravatar image

It has nothing to do with the windows version.

I wrote that I use two different computers. It depends if the processor supports SSE2 instructions or not.

The crash may happen on any Windows version.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-06-15 15:10:07 -0600

Seen: 1,030 times

Last updated: Jun 15 '14