Bug 917323 - Win32 apps built with mingw32-qt5-qtbase always crash at startup under wine and windows
Summary: Win32 apps built with mingw32-qt5-qtbase always crash at startup under wine a...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: mingw-qt5-qtbase
Version: 18
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Erik van Pienbroek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-03-03 06:49 UTC by olelukoie
Modified: 2013-05-22 03:17 UTC (History)
1 user (show)

Fixed In Version: mingw-qt5-qtbase-5.0.2-1.fc18
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-05-22 03:17:42 UTC
Type: Bug


Attachments (Terms of Use)

Description olelukoie 2013-03-03 06:49:05 UTC
Description of problem:

I have tried to build some test apps (including Qt5 examples) with mingw32-qt5-qtbase and all generated executabels of the GUI applications always crash on attept to run them under both wine and real Windows system (tested with WinXP 32-bit and Win7 64-bit).

Version-Release number of selected component (if applicable):
mingw-qt5-qtbase-5.0.1-2

How reproducible:
Always

Steps to Reproduce:
1. Install mingw32-qt5-qtbase with all dependencies
2. Build some of the Qt5 GUI examples (say analogclock example)
3. Try to run executable with wine or under Windows (copy all the required dlls from mingw32 dir to the executable's dir)
  
Actual results:
Crash at startup

Expected results:
Application should run normally

Additional info:

Comment 1 Erik van Pienbroek 2013-03-03 11:41:29 UTC
I've seen this happen when the library lib/qt5/plugins/platforms/qwindows.dll isn't bundled along with the executable. This is a run-time dependency of Qt5 and currently Qt5 only does minimal error handling/reporting in this area. Is this file already bundled along with your executable and in the correct path? If the path lib/qt5/plugins/platforms doesn't work you could try to use just the folder 'platforms'.

You should be able to find out what paths are exactly searched by running your executable using dependency walker.

If your executable still crashes, then please try to generate a backtrace of the crash using gdb (we've got a mingw32-gdb package in Fedora)

Comment 2 olelukoie 2013-03-04 18:02:34 UTC
well, yes, you're right, I've added platforms/qwindows.dll and the cash disappeared on Windows 7 and latest wine dev releases.

But according to this: http://qt-project.org/wiki/Qt_5.0 I can not use ANGLE-enabled Qt5 on Windows XP (and I really still get the crash or "Entry point for vsprintf_s not found in msvcrt.dll" error on XP SP3 and wine 1.4.1), so it seems like I should stop trying to use Qt5 and stick with Qt4 or try to rebuild Qt5 without ANGLE by myself...

Anyway this bug report can be closed. Thank you for your help.

Comment 3 Erik van Pienbroek 2013-03-04 18:20:33 UTC
If you get a fatal error about a missing vsprintf_s on Windows XP environments then this is a bug on our side which should be resolved. What version of mingw32-crt and mingw32-qt5-qtbase do you have installed?

Comment 4 olelukoie 2013-03-04 18:52:49 UTC
No, I think it's not your bug :) ANGLE uses this function directly (https://github.com/adobe/angle/blob/master/src/common/debug.cpp , line 27) and this function is not available in msvcrt.dll on Windows XP. It was added by MS only in Windows 7 (yes, I used depends.exe to check this twice).

Unfortunately mingw-w64 also added this function to its msvcrt.a so linking passes without any problem but the resulting executable can only be run on Windows 7. Win XP doesn't support it.

And there is another problem that I currently see with Qt5 on wine 1.4: qwindows.dll requires dwrite.dll (probably implicitly) that is not available on Windows XP too. analogclock.exe crashes on wine-1.4.1 almost immediately after wine complains in console that it cannot find dwrite.dll required for qwindows.dll. And there is no any problem with wine 1.5.25 that ships with this dll.

Comment 5 olelukoie 2013-03-04 18:54:38 UTC
the correct link to original ANGLE's debug.cpp file:
http://code.google.com/p/angleproject/source/browse/trunk/src/common/debug.cpp?r=1390

Comment 6 Erik van Pienbroek 2013-03-04 20:02:16 UTC
It's actually a missing feature in mingw-w64. Various Win32 'secure API' functions are wrapped in mingw-w64 so they can be used on Windows XP as well: http://mingw-w64.svn.sourceforge.net/viewvc/mingw-w64/trunk/mingw-w64-crt/secapi/
The Win32 API function vsprintf_s wasn't part of this set yet so I just created a patch for this and I'm going to propose it upstream.

For now I've rebuilt the mingw-angleproject package against this patched version of mingw-crt (the mingw-angleproject package was the only package which uses the vsprintf_s function). The resulting binaries can be found at http://ftd4linux.nl/contrib/libEGL.dll and http://ftd4linux.nl/contrib/libGLESv2.dll

Could you please try to test your Qt5 test executables using these DLL's on your Windows XP environment to make sure they work fine now? Once your testing is successful I'll push updated packages to Fedora.

Regarding your remark about dwrite.dll: You're correct that this library isn't available on Windows XP by default. My initial expectation was that Qt5 was smart enough to detect the availability of this library at runtime, but based on your feedback this apparently isn't the case. I just took a quick look at this and I think there are two issues in this area:
* The DWriteCreateFactory declaration in the mingw-w64 dwrite.h header should be guarded inside an #if (_WIN32_WINNT >= 0x0601) section as this function is only available as of Windows 7: http://msdn.microsoft.com/en-us/library/windows/desktop/dd368040%28v=vs.85%29.aspx
* Qt5 should try to resolve the DWriteCreateFactory symbol at runtime and fallback to the old font rendering method when it couldn't be found

Did you already try to generate a backtrace for the Qt5 crash which occurs when the platform DLL is missing? Perhaps I can come up with a patch (and propose it upstream) to make Qt5 not crash when the platform DLL couldn't be found

Comment 7 olelukoie 2013-03-05 21:56:20 UTC
I can not generate good backtrace. Under wine 1.4.1 I can not run gdb.exe - it just hangs on its command prompt and doesn't perform any command (even 'quit' so I have to kill it). winedbg gives me just 4 lines of backtrace, three of which somewhere in msvcrt.dll and the last one in one of qt5core.dll:

Wine-dbg>bt
Backtrace:
=>0 0x7bc76a4d DbgBreakPoint+0x1() in ntdll (0x00140928)
  1 0x7eb0509d in msvcrt (+0x1509c) (0x00140928)
  2 0x7eb0511a in msvcrt (+0x15119) (0x00140928)
  3 0x7eb054c3 MSVCRT_abort+0xa2() in msvcrt (0x00140928)
  4 0x6674d8d5 in qt5core (+0xd8d4) (0x00140928)
Wine-dbg>

It seems like it just doesn't see *.debug files that are placed alongside *.dll files.

Under Windows XP the original libEGL.dll and libGLESv2.dll do not run due to vsprintf_s issue and the new ones give me the error of type "Entry point for _ZNKSt8__detail20_Prime_rehash_policy11_M_next_bktEj not found in libstdc++-6.dll". (hope I have correctly written the procedure name :) )

And I do not have Windows 7 machines in my possession currently so for testing I have to ask some of my colleagues with Win7 to allow me to use their machine for some time and it's not always possible.

Several days ago I had tried to build Qt5 by myself and tried to run winedbg using non-stripped versions of dlls and it gave me much more informative backtrace but unfortunately I had not saved that backtrace and already removed that build of Qt5.

Comment 8 Erik van Pienbroek 2013-03-06 09:03:00 UTC
Yeah, running gdb under wine can be quite a pain to get working..
If you have a Windows XP environment available that should also be good enough for testing.

The libstdc++6.dll error is probably caused by the fact that I'm already using a more recent version that the one which is in Fedora 18 (gcc 4.8 vs gcc 4.7: https://fedoraproject.org/wiki/Features/MinGW_GCC_4.8). I'll build an updated copy of ANGLE against the older gcc and publish updated DLLs later today

Comment 9 olelukoie 2013-03-08 19:25:57 UTC
My attempt to run gdb on Win 7 failed too. I've got the following:

K:\test_qt5_fc18>gdb.exe analogclock.exe
GNU gdb (GDB) 7.5.1
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-w64-mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from K:\test_qt5_fc18\analogclock.exe...done.
(gdb) cont
The program is not being run.
(gdb) run
Starting program: K:\test_qt5_fc18\analogclock.exe
[New Thread 3836.0xe84]
warning: section .gnu_debuglink not found in K:\test_qt5_fc18\Qt5Core.dll.debug
warning: section .gnu_debuglink not found in K:\test_qt5_fc18\zlib1.dll.debug
warning: section .gnu_debuglink not found in K:\test_qt5_fc18\Qt5Gui.dll.debug
warning: section .gnu_debuglink not found in K:\test_qt5_fc18\libGLESv2.dll.debug
warning: section .gnu_debuglink not found in K:\test_qt5_fc18\libpng15-15.dll.debug
warning: section .gnu_debuglink not found in K:\test_qt5_fc18\Qt5Widgets.dll.debug
warning: Failed to load platform plugin "windows". Available platforms are:


warning: Invalid parameter passed to C runtime function.

warning: Invalid parameter passed to C runtime function.

[Inferior 1 (process 3836) exited with code 03]
(gdb) bt
No stack.
(gdb)

Have I missed something? Should I copy not only gdb.exe but also the content of share/gdb folder? If yes then where should I put it under Windows?

Comment 10 Fedora Update System 2013-05-03 22:01:50 UTC
mingw-qt5-qtbase-5.0.2-1.fc18, mingw-qt5-qtjsbackend-5.0.2-1.fc18, mingw-qt5-qtscript-5.0.2-1.fc18, mingw-qt5-qttools-5.0.2-1.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/mingw-qt5-qtbase-5.0.2-1.fc18,mingw-qt5-qtjsbackend-5.0.2-1.fc18,mingw-qt5-qtscript-5.0.2-1.fc18,mingw-qt5-qttools-5.0.2-1.fc18

Comment 11 Fedora Update System 2013-05-03 22:53:59 UTC
mingw-crt-2.0.999-0.17.trunk.20121110.fc18,mingw-angleproject-0-0.4.svn1561.20121214.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/mingw-crt-2.0.999-0.17.trunk.20121110.fc18,mingw-angleproject-0-0.4.svn1561.20121214.fc18

Comment 12 Fedora Update System 2013-05-05 02:21:41 UTC
Package mingw-crt-2.0.999-0.17.trunk.20121110.fc18, mingw-angleproject-0-0.4.svn1561.20121214.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing mingw-crt-2.0.999-0.17.trunk.20121110.fc18 mingw-angleproject-0-0.4.svn1561.20121214.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-7425/mingw-crt-2.0.999-0.17.trunk.20121110.fc18,mingw-angleproject-0-0.4.svn1561.20121214.fc18
then log in and leave karma (feedback).

Comment 13 olelukoie 2013-05-10 08:42:16 UTC
New packages seem to fix the compatibility issue. I've tried to run some qt5 examples under Win XP SP3 and they worked without any problem. And I even had not need to rebuild them.

Comment 14 Fedora Update System 2013-05-13 00:27:02 UTC
mingw-qt5-qtbase-5.0.2-1.fc18, mingw-qt5-qtjsbackend-5.0.2-1.fc18, mingw-qt5-qtscript-5.0.2-1.fc18, mingw-qt5-qttools-5.0.2-1.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 15 Fedora Update System 2013-05-22 03:17:42 UTC
mingw-qt5-qtbase-5.0.2-1.fc18, mingw-qt5-qtjsbackend-5.0.2-1.fc18, mingw-qt5-qtscript-5.0.2-1.fc18, mingw-qt5-qttools-5.0.2-1.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.