You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Wednesday, December 2nd 2009, 8:35am

Qt 4.6 linking problem

Hi, I just installed Qt 4.6 and I'm trying to compile simple application. There is no problems in compilation phase but in linking phase I got following error


g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o debug\test.exe debug/main.o debug/test.o debug/moc_test.o -L"c:\Qt\2009.05\qt\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4
c:\Qt\2009.05\qt\lib/libqtmaind.a(qtmain_win.o): In function `WinMain@16':
C:\qt-greenhouse\Trolltech\Code_less_create_more\Trolltech\Code_less_create_more\Troll\4.6\qt\src\winmain/qtmain_win.cpp:93: undefined reference to `_Unwind_Resume'
C:\qt-greenhouse\Trolltech\Code_less_create_more\Trolltech\Code_less_create_more\Troll\4.6\qt\src\winmain/qtmain_win.cpp:135: undefined reference to `_Unwind_Resume'
c:\Qt\2009.05\qt\lib/libqtmaind.a(qtmain_win.o):../../include/QtCore/../../src/corelib/tools/qvector.h:481: undefined reference to `_Unwind_Resume'
c:\Qt\2009.05\qt\lib/libqtmaind.a(qtmain_win.o):../../include/QtCore/../../src/corelib/tools/qvector.h:482: undefined reference to `_Unwind_Resume'
c:\Qt\2009.05\qt\lib/libqtmaind.a(qtmain_win.o):qtmain_win.cpp(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
mingw32-make[1]: Leaving directory `C:/Programming/workspace/Qt/test'
mingw32-make[1]: *** [debug\test.exe] Error 1
mingw32-make: *** [debug] Error 2

I have never got this kind of error. Is there bug in qt library because it tries to locate "C:\qt-greenhouse\...." folder which I don't have. Any idea how to fix this.

2

Thursday, December 3rd 2009, 6:40am

SOLVED

I build qt from source and it works now.

space_otter

Beginner

Posts: 8

Location: Neptune

  • Send private message

3

Sunday, December 20th 2009, 4:05am

Same problem

I have the same problem. How do you build from source?

4

Thursday, February 25th 2010, 9:00am

I got the same error when linking my release code but when I link the debug version it works perfectly.

I read this somewhere: "'__gxx_personality_v0' is a symbol from libstdc++. You have to link c++
programs using g++ not gcc - should solve your problem."

For me it looks like I am already linking with g++ but maybe this helps someone else?

I am using eclipse. Where do you set compiler and linker?

Thanx

5

Thursday, February 25th 2010, 3:30pm

You have to build the libraries to be able to link ok.
For example:
Start -> Programs -> Qt -> Qt Build Debug Libraries

I have no Qt Build Release Libraries, thats why I get the error during Release linking.

6

Monday, April 5th 2010, 9:00pm

The problem is actually because official gcc 4.4.0 is dw2, while TDM is default to SJLJ, and qt is compiled against the official gcc and not TDM.
A workaround for this is to install TDM dw2 files, then inside qt pro file add these lines to use dw2 gcc.
QMAKE_CXX = g++-dw2
QMAKE_CC = gcc-dw2
QMAKE_LINK = g++-dw2

Or you can use the official gcc4.4.0

7

Thursday, April 15th 2010, 5:38pm

Hello,

I've got the same problem. I use MinGW 4.4.0 (manual installation). My errors are debug/....o: In function `Z5qMainiPPc':
F:/....cpp:4: undefined reference to `__gxx_personality_sj0'
F:/....cpp:4: undefined reference to `_Unwind_SjLj_Register'
F:/....cpp:6: undefined reference to `_Unwind_SjLj_Resume'
F:/....cpp:6: undefined reference to `_Unwind_SjLj_Unregister'
collect2: ld returned 1 exit status


What do TDM and dw2 mean and what would I have to do to sove this problem?


Thanks for help which is much appreciated!


Lars


Also: how do I build the QT libraries manually? I don't have a start menu entry for this.

8

Thursday, April 15th 2010, 6:21pm

Hello again,
I found TDM on the web and added the dw2 core and g++ files to my MinGW installation and the dw2 lines to my .pro.
Dw2 gets used, yet the errors remain the same (so apparently I had a different problem from the beginning, ie. dw2 was already in use).

Do you have any solutions for this problem? Qt 4.6.2 any Qt application MinGW 4.4.0.

Thanks for help!

Lars

9

Thursday, April 15th 2010, 8:36pm

I downloaded the sources from Qt.nokia.com (sources = not the SDK) and installed them. I executed configure.exe in the main directory and started the debug build from the start menu.

I changed the Qt environment to use in QtCreator (see http://www.qtcentre.org/threads/29885-Ho…-source-package).

I cleaned the build and now can build debug and release versions of Qt applications.

Problem solved.

10

Friday, July 16th 2010, 9:06pm

Hi,

The problem described here is about the Exception model used by the gcc compiler. Two of those exists, one is called dwarf the other one is called sjlj (for shot jump, long jump). While dwarf has lower performance hit it has the big drawback that exceptions from native libraries do no longer work (like DirectX). At least this is what I've read in the README of TDM:

----------------------------------------------------------------------------

*** Dwarf-2 vs. SJLJ unwinding ***

GCC 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 handle
exceptions much more quickly than programs which utilize the SJLJ method. However, the
DW2 method increases code size by a noticeable amount, and additionally 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 handling and can be certain
youwill never throw an exception through a foreign stack area.

----------------------------------------------------------------------------

Unfortunately the official version of Mingw 4.4 chooses dwarf over sjlj and also removes the possibility to enable it on demand (via -enable-sjlj-exceptions). There is currently no gcc 4.4.4 variant available (latest stable) compiled with the sjlj option (TDM and others have not upgraded their 4.4.1 version). If you are like me and don't trust 4.x.0 versions you are forced to compile a Mingw 4.4.4 by yourself so it supports sjlj.

The main question remaining is which patches to choose for your own compiler. So far I'm trying to find those by TDM, MingW, Loaden (was uploaded but is a bit tricky to find) and Nuwen (if patched at all).

Regards

This post has been edited 1 times, last edit by "suamor" (Jul 16th 2010, 9:13pm)


11

Tuesday, July 20th 2010, 8:11am

Hi,

I managed to get a working MingW 4.4.4 build. As I used a MingW/MSys mixed installation it was installed to MSys for me (/usr/bin points to msys/bin).

I currently don't have an upload possibility to offer my build and it's also untested except a small hello world program (file-based using errno) and the usual included gcc tests.

During build there was one error I was concerned about which don't seem to be a problem: "stage3-gcc not a directory".

I also tried to build a qt program called Antico but it failed as it requires an ported X11 library and I didn't find a free download anywhere (XMing is not available for free).

Regards,

Reinhard

This post has been edited 1 times, last edit by "suamor" (Jul 20th 2010, 8:18am)