Qt - incompatible .lib - LNK1112 - qt

I would like to write an application for Windows CE. I have already followed all the relevant steps, and started to write the application with Qt Creator.
However, when I started to build the code, there was the following error message:
QtCored4.lib(QtCored4.dll) : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'THUMB'
Maybe some more details:
I downloaded the library for Windows CE and I configured Qt-Opensource-Version 4.8.3 with following parameters:
configure -platform win32-msvc2008 -xplatform wince50standard-armv4i-msvc2008
All went well. Qt Creator did recognize the new version and added Windows CE as supported platform.
Now, I guess, that there will be the same problem with QtGuid4.lib. Does anybody know, where I get a compatible file?

The import library for a DLL - the .LIB file - contains machine code stubs that are linked into your program, that call through the import table for the EXE. Therefore, they have to match the processor family that you're compiling for.
You need to obtain the .lib file for the Windows CE ARMv4I build of QtCored4.dll. Try these instructions for building Qt for Windows CE.

Related

Run Binary With Specific QT Version - Cannot mix incompatible Qt library

I'm trying to replicate an application that we currently have running on a physical Ubuntu server using an Ubuntu machine in Virtual Box. It is a QT application but on the server we are running it using pm2 from NPM. After installing QT, and installing drivers needed for the application i've tried to run it but keep coming across this error:
Cannot mix incompatible Qt library (version 0x50701) with this library (version 0x50905)
I've inherited the code from someone else and don't want to change the project to QT5.9.5, so i'm trying to run with 5.7.1, I've followed instructions on other questions in order to change the QT version to 5.7.1 but still get the same error when running it.
I followed the instructions here:
https://unix.stackexchange.com/questions/116254/how-do-i-change-which-version-of-qt-is-used-for-qmake
When checking the QT version using "qmake -v" in the console I get the following output:
QMake version 3.0 Using Qt version 5.7.1 in /home/sam/Qt5.7.1/5.7/gcc_64/lib
So although it looks to me like i'm using the desired version of Qt (5.7.1), i'm still getting the incompatible library issue, i'm very new to all of this so apologies if this is a stupid question. If anyone could tell me what to do in order to use the compatible library that'd be great, thanks.
I will try to explain this in steps!
Each complete set of Qt libraries is called a Qt "distribution". You can get Qt distributions from a variety of sources:
Installed from the package manager of your OS (.deb/.rpm).
From a downloaded zip file on http://qt.io
As a cloned repo from git
etc..
Some of the available Qt distributions will come pre-built, and some will need to be built from sources. In either case they will all have a qmake program that is specific to that particular Qt distribution. This program is responsible for building programs so that they link to the particular Qt distribution that the qmake is part of. qmake is also used when building with QtCreator.
If you have a binary built with one qmake and you try to run it on another computer, it might find the wrong Qt libraries during dynamic linking and spit out errors of "incompatible version of Qt".
There are many solutions to this problem;
Collect all the Qt libraries (Mine are in /home/myusername/Qt/5.version/gcc_64/lib/*.so) in the same folder as your program executable. This will make sure they are prefered to any other version of Qt that may be in your dynamic linker's path.
Uninstall the OS supplied Qt version(s). This may not be advisable especially if other programs use them.
Rebuilt your program from source using the correct qmake.

Qt5 cross-compilation using MXE and NetworkAuth

I am trying to do a Qt cross-compilation from Linux(Ubuntu 16.04) to Windows by following these steps: Building Qt 5 on Linux, for Windows.
I successfully installed the full Qt5 using MXE and the above mentioned steps but, unhappily, I get an error regarding the NetworkAuth library, right after running
i686-w64-mingw32.static-qmake-qt5
in my project folder:
Project ERROR: Unknown module(s) in QT: networkauth
My .pro project file contains the networkauth inclusion as per Qt Documentation and is successfully compiled under Qt Creator:
QT = gui core multimedia network networkauth
I looked into < mxe root >/usr/i686-w64-mingw32.static/qt5/lib and could only find libQt5Network.a and libQt5Network.prl, but no networkAuth related files.
Does anyone have any suggestion on how to solve the problem?
The networkauth package was missing from MXE. I've created one and there's a pull request for it now: https://github.com/mxe/mxe/pull/2112
You can either wait until it's been accepted into the main project or build the patch or our fork manually.

Cant Run Application Created With QT5 And VS2013 In Windows XP

I have application created with QT5 and Visual Studio 2013. I also use QT WebEngine in my application.
My application works fine in windows 7 (32 bit) . For some reason i need to run it in windows xp sp3 (32 bit).
When i run it, I get the following error:
The procedure entry point strnlen could not be located in the dynamic link library msvcrt.dll
I press OK several time and it goes away and my QMainWindow will pop out, But its totally BLACK and i see the following errors in debugger.
class QWindowsEGLStaticContext *__cdecl QWindowsEGLStaticContext::create(class QFlags<enum QWindowsOpenGLTester::Renderer>): Could not initialize EGL display: error 0x3001
class QWindowsEGLStaticContext *__cdecl QWindowsEGLStaticContext::create(class QFlags<enum QWindowsOpenGLTester::Renderer>): When using ANGLE, check if d3dcompiler_4x.dll is available
The d3dcompiler_47.dll is in application directory too.
Whats wrong here?
UPDATE 1
I placed 3dcompiler_46.dll in executable's directory and this is what happened.
I still get The procedure entry point strnlen could not be located in the dynamic link library msvcrt.dll error but after i press Ok, I get the following error as well.
The procedure entry point _except_handler4_common could not be located in the dynamic link library msvcrt.dll
The QMainWindow is still BLACK and the errors about ANGLE is the same.
UPDATE 2
I build QT for Windows XP with following configuration
configure -release -opensource -opengl desktop -target xp -platform win32-msvc2013 -angle -icu -nomake examples -prefix C:\QT-Compile
I replaced QT dependency and ran my application, I got the following errors:
The application has failed to start because icuin56.dll was not found
The application has failed to start because icuuc56.dll was not found
I tried to find them in QT directory (C:\QT-Compile) and i couldn't but i had them on main machine that run in Windows Seven, I placed them next to executable and application run successfully and previous errors are gone, However, The QMainWindow is still BLACK and i have the following errors in my debugger in run time.
QOpenGLShaderProgram: could not create shader program
QOpenGLShader: could not create shader
bool __thiscall QOpenGLTextureBlitter::create(void) Could not link shader program:
Whats wrong now ?
UPDATE 3
This is how i configured QT.
configure -release -opensource -opengl dynamic -target xp -platform win32-msvc2013 -icu -nomake examples -prefix C:\QT-Compile
I used windeployqt.exe and placed required DLLs and ... next to executable.
Ran application in windows xp and i keep getting following errors then application crash.
Message Box :
The procedure entry point strnlen could not be located in the dynamic link library msvcrt.dll
QT Debugger :
class QWindowsEGLStaticContext *__cdecl QWindowsEGLStaticContext::create(class QFlags<enum QWindowsOpenGLTester::Renderer>): Could not initialize EGL display: error 0x3001
class QWindowsEGLStaticContext *__cdecl QWindowsEGLStaticContext::create(class QFlags<enum QWindowsOpenGLTester::Renderer>): When using ANGLE, check if d3dcompiler_4x.dll is available
Failed to load opengl32sw.dll (The specified module could not be found.)
class QOpenGLStaticContext *__cdecl QOpenGLStaticContext::create(bool): Failed to load and resolve WGL/OpenGL functions
The first error about msvcrt.dll is about not including visual studio runtime dlls with your binary file. It seems that on win XP machine these libs are different then the ones your app is linked against
The next two errors are about failing to start up ANGLE probably due to mismatch of MS VS runtimes that you have encountered previously.
Basically, just put msvcr110.dll and msvcp110.dll in your folder (or provide means to install MS VS Redistributable for 2013 Studio)
Here is detailed deployment doc from digia - http://doc.qt.io/qt-5/windows-deployment.html
Also i would advice you to use qt's tool windeployqt.exe as a part of deploy process.
Usage is simple - windeployqt.exe path/to/your/binary/file.exe
It will copy almost everything you app needs to run your app everywhere without bothering you to include some plugins and dlls etc (though it will not copy mentioned above MSVS runtime dlls)
Also if you are interested a post about using different opengl for qt5 built dynamically loading of graphical drivers ( tries to use default opengl -> is fails tries to use ANGLE -> if fails, tries to use opengl software (libmesa) ) - http://doc.qt.io/qt-5/windows-requirements.html#dynamically-loading-graphics-drivers
It's a bit more complicated then in Qt4, but when you finally handle it properly, it will be more fail safe even on machines with no graphical drivers or no direct X support or launched through VPN
UPDATE
It seems that both desktop opengl and ANGLE fails for you (which would mean, that you have OpenGL implementation version less then 3.0 (default on win xp has 2.0) for desktop opengl to fail and you don't have DirectX 11 or DirectX 9 correct drivers installed (for ANGLE to fail).
This would mean that this is either virtual machine or window without any drivers. To fix this issue, please include opengl32sw.dll (libmesa) to you executable file as well. This is another fallback in case both desktop and ANGLE failed.
You can take in from the folder where your QtCreator installed in folder /tools. Or download it here - http://download.qt.io/development_releases/prebuilt/llvmpipe/windows/
depending on your arch.
Also, try to put d3dcompiler_46.dll from your win xp next to your executable. This might fix runtime error and will allow to launch ANGLE - https://bugreports.qt.io/plugins/servlet/mobile#issue/QTBUG-44985
Update 2:
Let's get it line by line.
You've got The procedure entry point strnlen could not be located in the dynamic link library msvcrt.dll warning because of either you have win XP with not SP3 but SP2 (microsoft dropped support for win XP SP2 for MSVS 2013) - more details here where there is the same issue. Or there is the same bug here that would basically advice to use opengl software.
Now, the errors you see in log:
class QWindowsEGLStaticContext *__cdecl QWindowsEGLStaticContext::create(class QFlags<enum QWindowsOpenGLTester::Renderer>): Could not initialize EGL display: error 0x3001 - this is failure of OpenGL desktop, since you don't have Open GL 2.0 -> proper graphical driver.
class QWindowsEGLStaticContext *__cdecl QWindowsEGLStaticContext::create(class QFlags<enum QWindowsOpenGLTester::Renderer>): When using ANGLE, check if d3dcompiler_4x.dll is available - ANGLE is failed. Because either - qt uses mvcrt.dll for MSVS 2013 that does not support your Win XP SP2 anymore or you don't have d3dcompiler. Perhaps it will work with Qt 5.4 built with MSVS 2008 or MSVS 2012.
Failed to load opengl32sw.dll (The specified module could not be found.)
class QOpenGLStaticContext *__cdecl QOpenGLStaticContext::create(bool): Failed to load and resolve WGL/OpenGL functions - These errors relates to missing opengl32sw.dll file. Which i've already provided link for you to download and put to executable.
And app crashes because Qt was not able to run any of OpenGl modes at all. So basically all you can do is force app to use OpenGL software (i provided link for you how to do this numerous times, please read those guide.) or use qt 5.4 and try to run angle. OpenGL software may not run smoothly and have some problems with complex graphical interfaces but this is basically the only thing that is left.
We met the same problem in win 7, solved by install the graphics card driver
I have found another solution as a side option to switch from opengl to software rasterizer and remove these messages:
Could not initialize EGL display: error 0x3001
When using ANGLE, check if d3dcompiler_4x.dll is available
Because in mine case it was the VirtualBox environment which currently having problems with the OpenGL/DirectX (https://forums.virtualbox.org/viewtopic.php?t=82614&start=15#p408392) implementation, then i have tried to search for a solution and somehow workaround the render.
The QT itself have has an option to switch or disable several builtin options w/o need to rebuild anything. Such as is described here:
https://doc.qt.io/qt-5/windows-requirements.html#dynamically-loading-graphics-drivers
It is possible to provide a JSON-format configuration file specifying which OpenGL implementation to use depending on the graphics card and driver version. The location is given by the environment variable QT_OPENGL_BUGLIST. Relative paths are resolved using QLibraryInfo::SettingsPath or QStandardPaths::ConfigLocation. The file utilizes the format of the driver bug list used in The Chromium Projects. It consists of a list of entries each of which specifies a set of conditions and a list of feature keywords. Typically, device id and vendor id are used to match a specific graphics card. They can be found in the output of the qtdiag or dxdiag tool.
The qtdiag tool is stored basically near the qmake executable. You can additionally run it to diagnose the end system on other errors.
For the VirtualBox you can try this:
{
"entries": [
{
"id": 1,
"description": "Software OpenGL rasterizer (opengl32sw.dll)",
"os": {
"type": "win"
},
"vendor_id": "0x80EE",
"device_id": ["0xBEEF"],
"driver_version": {
"op": "<=",
"value": "5.1.38.22592"
},
"features": [
"disable_desktopgl", "disable_angle"
]
}
]
}
, Where:
disable_desktopgl, disable_angle - When no accelerated path is desired. This ensures that the only option Qt tries is the sofware rasterizer (opengl32sw.dll). Can be useful in virtual machines and applications that are deployed on a wide range of old systems.
the 5.1.38.22592 is a version of the VirtualBox.
This is might be not what you search for, but i didn't found it in time for myself.

static linking of standard QT libraries

I am trying to build an QT application with version 5.4.
and when ever I am trying to run the exe on a different machine where QT is not installed I am getting below error "The program cannot start because QT5core.dll is missing from your computer, Try reinstalling the program to fix this problem".
and when I copied QT5core.dll with the exe in a machine where QT is not installed its working fine.
Is there any way that I can link QT5core.dll with the exe statically so that whatever place I run this exe it should not ask for any dll.
Thanks,
Tushar
You can build a standalone version of your Qt application so that it doesn't have any library dependencies at runtime. Be warned though: this can greatly expand the size of the .exe generated and the compilation time. Have a look here:
https://wiki.qt.io/Build_Standalone_Qt_Application_for_Windows
and here:
https://wiki.qt.io/How_to_build_a_static_Qt_version_for_Windows_with_gcc

How to change the compiler in Qt creator 64-bit

I created a application in linux and now I am trying to import this application to windows which is 64-bit. I installed Qt creator(64-bit) and imported the project.I am using certain libraries like omniORB4 which are built on 64-bit.Now when I try to build the application I get the following error:
module machine type 'x64' conflicts with target machine type 'x86'
Qt Version : Qt 5.3.1 (MSVC 2013, 64 bit)
Visual Studio :2010
When I imported the project in Qt on windows there was a option to configure the project and it showed only " Microsoft Visual C++ Compiler 10.0(x86)" in the options. I think I am getting this error because my compiler is x86. there are few other compilers which are shown in Project Properties but when I select them it gives me a error. Is there any way that I can change my compiler to x64 in QT and what are the other options that I can follow to resolve this issue. I looked into many links but still no luck.

Resources