Ask Your Question
1

OpenCV 2.4.3 MinGW cannot run program

asked 2012-11-04 05:04:36 -0600

jnovacho gravatar image

I have downloaded the most recent OpenCV pack. After instalation I have created simple program:

#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"

using namespace cv;

int main(int argc, char **argv)
{
    Mat img = imread("c:\\plane.jpg");
    imshow("win", img);
    waitKey(0);
    return 0;
}

Program compiles fine, but when I try to run it, I get SIGSEGV. I'm using MinGW 4.7.0 on Win7 64bit, but the software is 32bit, no problem there. Before I was using 2.3.1 with MingGW 4.6.1 and everything was fine. So I've rolled back to MinGW 4.6.1 compile is again all right. But when I tried to run the program, I got following error:

Cannot find entry point of procedure __gxx_personality_v0 in dynamically linked library libstdc++-6.dll

So it's clear to me, that I have to use newer version of MinGW. Does anyone know which MinGW was used to create prebuild libraries?

Here are logs from GDB and Dependency Walker Profiler: http://pastebin.com/b4LHhixe Is clearly visible, that libstdc++-6.dll is causing the error.

edit retag flag offensive close merge delete

Comments

Im having a similar problem with opencv 2.4.3 and minigw.

kyleg001 gravatar imagekyleg001 ( 2012-11-06 22:08:04 -0600 )edit

I also have a problem with libstdc++-6.dll and not being able to run the compiled program. (Windows 7 32bit, mingw4.7.2, Opencv2.4.3)

genetica gravatar imagegenetica ( 2012-11-07 08:41:06 -0600 )edit
1

MinGW http://sourceforge.net/projects/mingw/ uses Dwarf-2 version of exceptions handling, while MinGW-w64 http://sourceforge.net/projects/mingw-w64/ uses SJLJ. OpenCV pre-build libraries for Win are compiled with Dwarf-2 exceptions and depends on libstdc++ with Dwarf-2 support.

mat gravatar imagemat ( 2013-06-02 20:01:26 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
3

answered 2012-11-07 11:07:03 -0600

genetica gravatar image

I had a similar problem, windows 7, MinGW 4.7.2 (the newest version).Except I could not run any opencv version. Such that after I compiled my code the program just crashes right after execution. Continually receiving errors from libstdc++ and opencv core module.

I downloaded the libstdc++ from http://www.2shared.com/complete/44qu1Jl9/libstdc-6.html (which I happen to stumble upon). I replaced my current libstdc++ with the downloaded one, this resolved the crashes and opencv seems to be working now.

It seems there is some problem with MinGW 4.7.x libstdc++ and windows 7. As this is not the first post of opencv/mingw/windows7 that appeared recently on the net. Hope this helps

:)

edit flag offensive delete link more

Comments

It works. Anybody know what the difference between them? (orgin. and new one DLL?)

volodia gravatar imagevolodia ( 2013-04-06 05:31:27 -0600 )edit

Working link: jaist.dl.sourceforge.net/project/hamilton/stdcpp6/2/2.0/dev-bin/libstdc++-6.dll

student_mas gravatar imagestudent_mas ( 2013-07-18 14:39:38 -0600 )edit

thanks, tried everything, bt only this worked ,

p.chaturvedi gravatar imagep.chaturvedi ( 2013-09-16 16:16:34 -0600 )edit
2

answered 2013-04-22 06:12:59 -0600

briselec gravatar image

from the README-gcc-tdm.text file --

"GCC currently supports two methods of stack frame unwinding: Dwarf-2 (DW2) or SJLJ (setjmp/longjmp). Until recently, only SJLJ has been available for the Windows platform. This affects you, the end user, primarily in programs that throw and catch exceptions. Programs which utilize the DW2 unwind method generally execute more quickly than programs which utilize the SJLJ method, because the DW2 method incurs no runtime overhead until an exception is thrown. However, the DW2 method does incur a size penalty on code that must handle exceptions, and more importantly the DW2 method cannot yet unwind (pass exceptions) through "foreign" stack frames: stack frames compiled by another non-DW2-enabled compiler, such as OS DLLs in a Windows callback.

This means that you should in general choose the SJLJ version of the TDM-GCC builds unless you know you need faster exception-aware programs and can be certain you will never throw an exception through a foreign stack area.

As distributed, the SJLJ and DW2 packages of TDM-GCC can coexist peacefully extracted to the same directory (i.e. any files in common are for all intents and purposes identical), because the driver executables (the ones in the "bin" directory) are suffixed with "-dw2" for the DW2 build, and the libraries and other executables hide in another "-dw2" directory in "lib(exec)/gcc/mingw32". This allows you to use the same single addition to your PATH, and use DW2 exceptions only when you need them by calling "gcc-dw2", etc. If you truly want DW2 exceptions as the default when calling "gcc" (from Makefiles or configury systems, for example), you can rename or copy the suffixed executables to their original names."

libstdc++-6.dll will export either __gxx_personality_v0 or __gxx_personality_sj0 depending on which unwinding method it supports. opencv uses Dwarf-2. If you use tdm-gcc (http://tdm-gcc.tdragon.net/) you can choose which unwinding method you want.

edit flag offensive delete link more

Question Tools

3 followers

Stats

Asked: 2012-11-04 05:04:36 -0600

Seen: 15,491 times

Last updated: Apr 22 '13