I'm using the MinGW-builds toolchain provided by Qt 5.0.2 to build a project. Overall, things are going well, but I seem to have run into a snag. When a beta tester ran the program on his Windows XP machine, the program instantly crashes with the following error:
I poked around using Dependency Walker and discovered two things:
msvcrt.dll gets involved when MinGW's C++ runtime links to it:
amazingly, his computer (and several other computers in the office) have versions of msvcrt.dll (the Windows C runtime library) so old that they lack all the "secure" CRT additions (which MinGW's C++ runtime apparently uses).
Installing the Visual C++ runtime Qt provides (in Qt\Qt5.0.2\vcredist
) does nothing to solve the problem, as more recent versions of the runtime such as the one Qt uses provides different files (such as VS11's msvcp110.dll and msvcr110.dll) instead of replacing the old one.
Is there any workaround? It would seem that all versions of MinGW link to this file, and I would really prefer not to switch over to Visual Studio 2010 (the other option Qt 5 offers) due to its poor C++11 support. An initial idea would be to have the installer replace the old msvcrt.dll with a newer one, but
Many programs are actively using the runtime (imagine that), so it can't just be overwritten.
It sounds extremely evil for an installer for a piddly userspace application to reach into C:\Windows\System32
and start replacing files.
The copy of libstdc++-6.dll
that is installed with the prebuilt Qt 5.0.2 (with MinGW) package (qt-windows-opensource-5.0.2-mingw47_32-x86-offline.exe
) doesn't import memmove_s
from msvcrt.dll
.
Here's a dump of all the imports with "memmove" in the name from the various versions of libstdc++-6.dll
that are installed by the Qt 5.0.2 with MinGW package:
C:\qt\5.0.2>for /f "usebackq" %a in (`dir libstdc++-6.dll /s/b`) do dumpbin /imports %a | grep memmove
C:\qt\5.0.2>dumpbin /imports C:\qt\5.0.2\5.0.2\mingw47_32\bin\libstdc++-6.dll | grep memmove
418 memmove
C:\qt\5.0.2>dumpbin /imports C:\qt\5.0.2\Tools\MinGW\bin\libstdc++-6.dll | grep memmove
418 memmove
C:\qt\5.0.2>dumpbin /imports C:\qt\5.0.2\Tools\MinGW\i686-w64-mingw32\lib\libstdc++-6.dll | grep memmove
418 memmove
C:\qt\5.0.2>dumpbin /imports C:\qt\5.0.2\Tools\MinGW\i686-w64-mingw32\lib64\libstdc++-6.dll | grep memmove
402 memmove
No imports of memmove_s
show up.
Your screenshots seem to show that appmanager.exe
depends on msvcrt.dll
directly as well. Perhaps that's where the dependency on memmove_s
comes from? Try running the following command:
dumpbin /imports appmanager.exe | grep memmove
(you'll need a MS toolchain to get dumpbin, which is just a wrapper around link /dump
. I couldn't get objdump
to process libstdc++-6.dll
usefully).