QT 5.0.2 app compile with W7 VS2012 don’t run on Win XP because of GetTickCount64 call from QTCore
-
Hi,
I use W7 x64 and VS2012 so I download source code from "here":http://qt-project.org/downloads . Compiled it according "this":http://qt-project.org/doc/qt-5.0/qtdoc/install-win.html . Of course I change setting for VS2012 and win32 etc. I did it because there isn’t precompiled 32-bit version for VS2012.I have small test application (no more than main window and few buttons). I can compile it as win-32 application and everything work fine on W7. But when I want to run it on Win XP (32bit) it doesn’t work. I set Platform toolset on ‘Visual Studio 2012 - Windows XP (v110_xp)’. I have all necessary libraries on Win XP machine (VS2012 libraries and QT libraries) but QT5Core.dll calls GetTickCount64 which is not in Win XP.
Question is: What can I do about it? Is it at least possible? Or am I trying something impossible? Maybe I compiled QT wrong (wrong for deployment on Win XP)… I did not set platform set for win XP… I don’t know how or if it is even possible. And I could not do it because I didn’t have patch for VS2012 at that time which allows it.
-
-No, it's impossible.- EDIT: Sorry, not impossible, but requires extra configuration
http://blogs.msdn.com/b/vcblog/archive/2012/06/15/10320645.aspx
"The C++ runtime and libraries that accompany Visual Studio 2012 contain dependencies on several Windows API functions that exist only on Windows Vista and higher versions of the OS. This means that applications built with Visual Studio 2012’s C++ compiler will fail to load and execute on Windows XP."
EDIT: The blog also says "Developers wishing to target Windows XP can use Visual Studio’s C++ multi-targeting feature, which enables the use of the Visual Studio 2010 compiler from within the new IDE."
-
Impossible? I mentioned that I use Platform toolset: ‘Visual Studio 2012 – Windows XP (v110_xp)’
So it should work (as far as I know) "see":http://blogs.msdn.com/b/vcblog/archive/2012/10/08/10357555.aspxI case I would use just 'v110' it would be really impossible. But with 'v110_xp' applications work (but not with QT).
I am starting to think I probably compiled QT wrong (for XP). I will try figure out how to set it right setting and compile it again. But I don't like this solution because it takes a lot of time to try and I am not sure about it.
-
I tried to recompile QT. I used the setting described "here":http://blogs.msdn.com/b/vcblog/archive/2012/10/08/10357555.aspx(just settings environment variable to older SDK). It works Ok for plain C++ application. Everythink went Ok, but libGLESv2.dll is dependent on d3dcompiler_46.dll. What I can do about it? The higest version for win XP is DirectX 9c (which include only D3DCompiler_43.dll)… Of course I tried to use d3dcompiler_46.dll in win XP but it seems to have some other dependencies.
I used this setting for compile QT: configure -debug-and-release -nomake examples -nomake tests -angle -opensource
Then I decided if it doesn’t work let’s try something else. I compiled it with openGL. Now in win XP when I am trying to start application nothing is happening (no window is invoked). In Win7 it works fine.
I used this setting for compile QT: configure -debug-and-release -nomake examples -nomake tests -angle -opensource -no-icu -no-gif -no-libpng -no-libjpeg -no-openssl -no-dbus -no-audio-backend -no-qml-debug -mp -no-iwmmxt -no-crt -no-cetest
Maybe I did something completely stupid. I am not very good in compiling QT yet. :) If nobody helps me I will probably really use VS2010 for compiling app to win XP. Because I am really frustrated now.
-
Maybe I can add my batch for environmental variables before configure command and nmake:
CALL "c:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86
set PATH=c:\Qt\5.0.2-x86\qtbase\bin;c:\Qt\5.0.2-x86\qtrepotools\bin;c:\Qt\5.0.2-x86\gnuwin32\bin;%PATH%
set QMAKESPEC=win32-msvc2012set INCLUDE=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Include;%INCLUDE%
set PATH=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Bin;%PATH%
set LIB=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Lib;%LIB%
set CL=/D_USING_V110_SDK71_;%CL% -
Hi,
No it's not stupid... making cross-platform (or cross-platform-version) libraries is hard :)
"ANGLE":http://blog.qt.digia.com/blog/2012/10/24/graphics-on-windows-from-a-different-angle/ is the component that makes Qt use DirectX instead of OpenGL. When you compile Qt with ANGLE, it will link against the version of DirectX that's on your computer. If you compile Qt in Win7, it will link against d3dcompiler_46.dll; if you compile Qt in WinXP, it will link against d3dcompiler_43.dll.
You have a few options:
Do your development in WinXP (If you compile your program in WinXP, it should work in Win7)
Find a way to get an older DirectX SDK on your Win7 computer (I'm not sure if this is possible though)
Use OpenGL instead of ANGLE
Drop WinXP support -- Microsoft will "stop supporting it in April 2014":http://www.microsoft.com/en-us/windows/endofsupport.aspx
For option #3, you'll need to use OpenGL 2.0 or higher (and use the '-opengl desktop' configuration flag, instead of '-angle'). HOWEVER, if you do this, Qt will link to the OpenGL graphics drivers on your computer -- all computers that run your app will then need a graphics card that supports the same version of OpenGL as your Win7 development computer.
-
I'm currently wrestling with a similar issue VS2012/Win7 targeting XP and trying to build Qt4 (4.8.5).
What I've found out is that the folder settings in that MSDN blog are incorrect. They are pointing to %ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\ when they actually should point to %ProgramFiles(x86)%\Microsoft SDKs\Windows*v*7.1A. If nothing else, this will make the compiler fall back to whatever else was set for PATH, INCLUDE and LIB, which most probably are the Windows 8 versions.
My problem currently is that I, for some reason, cannot link against the built version of Qt. My projects were built from within VS2012 with the v110_xp platform setting. The non-Qt projects compiled without issue, while the Qt projects come up with linker errors (usually with regard to QMetaObject).
Qt on the other hand was built from the command prompt with the following options: -commercial -confirm-license -platform win32-msvc2012 -plugin-sql-sqlite -plugin-sql-odbc -qt-libpng -qt-libjpeg -openssl.
What I've noticed is that every single file in Qt seems to trigger the following error:
c:\program files (x86)\microsoft sdks\windows\v7.1a\include\sal_supp.h(57) : warning C4005: '__useHeader' : macro redefinition
C:\VS11\VC\Include\sal.h(2872) : see previous definition of '__useHeader'
c:\program files (x86)\microsoft sdks\windows\v7.1a\include\specstrings_supp.h(77) : warning C4005: '__on_failure' : macro redefinition
C:\VS11\VC\Include\sal.h(2882) : see previous definition of '__on_failure'I don't know if that has something to do with the issues I'm facing.
-
Well actually I didn’t try it since my last post. I didn't have much time and some real need for it.
But what I found is that even in case that you set environment to build for WinXP QT will change it during the building process (or will use its own setting). So I thing that some change inside QT would be necessary to build it for WinXP (maybe just some build scripts, maybe more). I think that simply nobody really take care about using VS2012 for WinXP.
For me it seems to be very challenging to do something about it since I don't know how QT really works. I am merely user of it. If I will want to support WinXP I will try again find something (if there is change from last time) or I will probably use VS2010.
Everything what I wrote is just my opinion. I am not really sure about it.
-
Hi,
[quote]But what I found is that even in case that you set environment to build for WinXP QT will change it during the building process (or will use its own setting). [/quote]Can you show us how you set the environment?
Qt is a library, and doesn't know about compiler settings. It's the build system that chooses/sets compiler settings. How do you build your app?