Qt-Application Deployment doesn't work. Missing entry point and dll's - c++

In the last months I created a project with the Qt-Creator version 4.7.0, Qt version 5.11.1 (open source version).
Now I tried to deploy it following the Qt doc and building the project with MSVC2017-64bit compiler as well as running windeployqt.exe afterwards on the generated executable.
As I tried to run the executable after the programm finished copying the neccessary dlls into the folder, a warning appeared:
The entry point ?
eventFilter#QAbstractItemView##MEAA_NPEAVQObject##PEAVQEvent###Z wasn't found in DLL "my/project/path/releasefolder/project.exe".
It seems to me like something was wrong with the Qt-Objects I use in my project, but I couldn't find anything, as it still worked flawlessly in the Qt-Creator.
A thought it might be due to the compiler having issues, so I changed it to mingw32, which I also tried to deploy the same way. But somehow in this case the warning disappeared, but many dlls were still missing even though windeployqt.exe should've already done that. And I also couldn't find them anywhere on my hard drive. I also tried a third compiler, but the issues weren't going away.
I searched online and only found people having problems with an entry point missing in a Qt dll or missing the Qt-Dlls in general, but haven't found anything related to my case.
I also tried Dependency Walker on every executable, but it found even more missing dll, which led me to believe the executables were somehow currupted so I tried it again and again, but with no success unfortunately.
Has someone any idea, why that could happen, or any suggestion for me?
Maybe I should change something in my project, even though it works fine in the IDE. I just need a way to deploy my Qt project in any way.
EDIT: Build using the Desktop Kit in Qt Creator with MSVC2017 the described warning appeared.
Build with Mingw32 (Desktop Kit) and with MSVC2017 using the UWP Kit in Qt Creator the following Dll was missing, that I haven't found anywhere on my hard drive: MSVCP140_APP.dll
EDIT2: I ended up downloading the required dll, to somehow get it to work, but it still didn't work. One build, that required that dll now started but immediately closes itself again and the other build was suddenly warning me of a missing procedure entry point.
EDIT [SOLUTION]: I let the Qt Creator create a whole new fresh project and copied all files from my old project in the new one. After that I only copied all the dll files into the folder and it worked.

Instead of relying on windeploy, manually add the dll. I am assuming you have built the project using mingw. Assuming you are using Qt 5.11.1, go to
C:\Qt\Qt5.11.1\5.11.1\\bin\ and copy all the dll files and paste in your executable folder. Also copy all directories from plugins folder (in /plugins) and paste in your folder. Now run the application, don't close the application. Now delete all the files from your executable folder. The one's not being used are deleted and the rest are left. I assume you are doing this on target computer. This might help.

Related

Missing libgcc_s_seh-1.dll starting the .exe on Windows

Intro
I have a CMake-based C++ project. Until now I build and ran the project via CLion. Everything worked fine until I tried to run the .exe-file directly (not via CLion).
Problem
When I navigate to the cmake build directory in order to start my program via the executable file, it fails with the following message in the popup: Cannot continue the code execution because libgcc_s so-1.dll was not found. Reinstalling the program may resolve the issue.
I have the following questions
If I interpret the error message correctly, then this dll is missing on my computer. So I ask myself, why does my program still work when I start it via the development environment (CLion), although the error message expressly states that the source code requires this dll?
Is it the fault of my application/source code that the error appears or rather the current state of my computer? If the former, how can I prevent this error from appearing for other users?
What is the best way to fix this error? It's obvious that I need to download this dll, but where is the best place to put it (which directory and environment variable to use on Window)?
Which source is trustworthy to download this dll? I don't want to download any malware under this dll-name.
Optional: What kind of library is that? What functionalities does it offer?
Additional information
I use CMake as my build tool, CLion as the IDE and MinGW as the compiler.
What I have did so far?
I made sure it still works through the IDE.
I found this dll does not exist in the MinGW installation folder.
I searched the web for more information. Unfortunately, there are only pages unknown to me that only offer the download of this dll. That doesn't satisfy me.
I found the cause of my problem: I had two MingGW installations on my machine. Once the installation that comes with CLion and a separate one. The latter did not have the required dll. However, CLion used its own installation, which in turn owns the DLL. So the solution was to remove the separate installation and include the path to the CLion installation's bin/ directory in the PATH environment variable.
This file is part of MinGW-w64 when using SEH as exception model (as opposed to Dwarf or SJLJ). You need to distribute the .dll files your .exe file(s) depend on in the same folder as the .exe file(s).
If you don't have that file, then you probably have been using libraries compiled with different versions of GCC/MinGW(-w64). I recommend building everything with the same compiler to ensure stable binaries.
Tools like Dependency Walker can help you figure out which .dll files your .exe file depends on.
Or use the command line tool copypedeps -r from https://github.com/brechtsanders/pedeps to copy the .exe files along with it's dependencies.

QT Deployment error

I am trying to deploy a QT5.4.1 appplication on Windows 7 - x86.
As always, everything is working fine on my machine, but not in the end user's machine.
When I try to run the app, it gives me the following error:
After searching on the internet, most solutions say that I need to add a platforms folders containing some dlls (qminimal, qoffscreen, etc) to the deployment package. I tried that with no success.
The funny thing is that I copied QT installation folder to the end user machine and deleted everything except this folder (C:\Qt\Qt5.4.1\5.4\msvc2012_opengl\plugins\platforms) and it works fine.
So, somehow my app is looking for the platforms folders in QT installation folder instead of the deployment package folder.
Does anyone know how to solve it?
EDIT:
I have managed to change all QT Dlls to the release version (without "d" sufix). However, when i compile my project I still get some vc++ dlls in debug mode. I checked all project configurations in both "linker" and "c/c++" sections and they all use "release" configurations. When I run the program, It gives me a "debug assertion failed". Why I am getting the debug versions of vc++ dlls?
Here is the dependency walker screenshot
The comments of Mezzo seem very relevant. We regularly deploy commercial Qt Windows applications. You could use dependency walker to find the dependencies or just double click on the executable and look at the Windows complaint about what dll's are missing. Just copy them to the deploy location, preferably with a qmake script.
The plugin dll's are more difficult to deal with. They do not show up as dependencies. The operating system could complain about their absence (dll's located in the subdir "platforms" for instance) or your application might just not use their functionality (dll's in the subdir "imageformats" for instance) without any complaint. To protect yourself against the latter case you have to test drive your application thoroughly.
Windows does not need a qt.conf file. Just create the subdirs "platforms", "imageformats", ... in the application dir and copy the plugin dll's there. As an example I show the full content of an (mingw) application dir that even when copied to a virtual machine runs without any problem.
Qt5Btc1.dll is our own dll.
I figure out what is wrong, although I don't have the solution yet. Even without the solution, I think this answer might be helpful.
My project output is a DLL that has a GUI made in QT.
Another program calls this DLL and during DLL_PROCESS_ATTACH a QT GUI is created.
According to the documentation, QT looks for the plugins in:
in the directory containing the application executable, i.e. > QCoreApplication::applicationDirPath() + QDir::separator() + "qt.conf"
That´s why the QCoreApplication::applicationDirPath() is not the deployment directory where the DLL is located, but the directory where the external program *.exe is running. I think QT is looking for the qt.conf file in this *.exe location
EDIT: there is nothing to do with debug or release versions

Having trouble building Qt program

I created a Qt GUI application and I am trying to package it to share with other people. I built the package and used Dependency Walker to find all of the .dll files that I needed to include. After I put them all in the same directory as the .exe; I launched the .exe for the program and I got a message that another .dll was missing I included it. I was asked in the same way to add two more .dll files. After all the .dll's were included I launched the .exe and got this weird message.
I consulted Qt 5.0.2 documentation and I couldn't find any help. It works fine when I run it within Qt Creator.
I don't know what to do from here but any help would be great
Some things you could do to find out the problem:
Check if it behave the same way in debug and release mode. Note that the two modes need different DLLs.
Check if you are using the correct versions of the DLLs. If you installed different versions of Qt or other dependencies than there could be conflicts around DLLs that are the same but from different versions. Maybe you are in a kind of DLL Hell.
You should copy your program to another PC that doesn't have Qt installed. And watch if it works properly.

Porting Qt4 to Qt5: unresolved external symbols

Qt5 is the new generation of Qt and it has some changes.
I have a project building well with Qt4. I've downloaded Qt5-VisualStudio2010 package and I'm trying to port my project from Qt4 to Qt5. Problems arise.
All 'include' paths have been fixed well. However, the compiler now reports hundreds of 'unresolved external symbols' (almost all function calls, sounds like the compiler can't find any .lib file). I even tried to add all .lib files found in the Qt SDK folder, but useless. The most basic class and method: QApplication::exec(...) also reported as 'unresolved symbol'.
The project file has been changed to fit Qt5 packaging:
myproject.pro file:
QT += widgets
Anyone have got similar experience with this new release of Qt?
From 'qt_newbie89' (http://qt-project.org/forums/viewthread/23200):
I have “accidentally” solved the problem. I rightclicked on the
project folder in the Project windows and choose qmake. After that,
choose Run and all the errors disappeared. I don’t know why that works
by the way.
From 'ChrisW67' (http://qt-project.org/forums/viewthread/23253/):
The Makefile file did not “become corrupted”: it was exactly as you
left it, full of commands and paths suitable for the previous Qt 4
installation. When Qt Creator ran nmake to build the project nmake did
not automatically re-run qmake to generate the Makefile because the
(untouched) Makefile was newer than the pro file that generated it.
This is normal and correct make behaviour, but it resulted in a
mismatch between your Qt5 in stall and expected Qt4 install.
My saying:
Yeah, that really solves the linking problem! The problem was actually that, when the project was created with Qt4, the 'make' file was also created along with the project nicely. When I removed Qt4, installed Qt5 and imported the old project by Qt5 (with new Qt Creator), possibly the 'make' file became corrupted.
I suspected that you would not be the only one who had this problem. Have you looked at: this yet? It talks about a PERL script in qt/base/bin called: fixqt4headers.pl. This is designed to fix the headers. I noticed another link which might help if that doesn't fix you up, try this, it looks to be fairly well thought out. And, no I haven't tried it. I haven't actually upgraded to Qt 5 yet. CHEERS!
This happened to me as well and I did following.
Additionally linked Qt5Widgetsd.lib
Changed the project property 'Treat Wchar_t as buil in' to true (at C++ -> Language section).

QScintilla, example project doesn't work

I wanted to try QScintilla out. So i downloaded and installed it, no problems.
When i ran the example project it said I was missing QtCored4.dll, so i copied it into the directory, then it said it needed other dll's aswell so copied them too.
At the end it gives me a Visual C++ Runtime error. It just says it terminated in an unusual way.
I know this is vague, but this is just what is states, no additional error messages. The code is from the website, i didn't modify it.
Anyone has any clues about this?
Now that i have this problem, i thought maybe i should extend the standard Qt text component. And try to make my own component like QScintilla.
How hard can it be, to write a component like QScintilla? (Without looking at its source)
Update: So i loaded the example project under Qt Creator. Set the default config to release mode and let it run. And it worked. (very weird). If i switch to debug mode Qt Creator says:
Invalid parameter passed to C runtime function.
If i go to the directory in the file system ( not in Qt Creator ) and run the program (release mode), i get the strange errors i told you about in the comment. While if i run it from Qt Creator it works.
I have no problems with QScintilla. I have Qt 4.6 compiled from sources with VC++ 2008. After downloading QScintilla-gpl-2.4.1 and unpacking I compiled it with:
cd Qt4
qmake qscintilla.pro
nmake
and finally installed with
nmake install
copy %QTDIR%\lib\qscintilla2.dll %QTDIR%\bin
And while compiling and running example I have no problems.
So, first check you environment variables (My Computer, Right Click, Properties -> Advanced tab -> Environment Variables button). Check Path in System Variables section. I have %QTDIR%\bin (c:\Qt\qt-4.6.0\bin) in this variable.
Secondly I'm wondering about letter "d" in your message:
QtCored4.dll
If you made all steps described in documentation you will get release version of libraries and release version of example application linked against release version of Qt libraries. And not debug.
Finally may be QTextEdit & QSyntaxHighlighter is enough for your tasks. Check out Syntax Highlighter Example.
Response to comments.
It's some sort of well known problem (may be). So, as you can see you have 2 different folders with Qt libs
C:\Qt\2009.05\bin;C:\Qt\2009.05\qt\bin
in your path. Libraries in the first folder (...\bin) compiled with VS2008 and libraries in the second one (...\qt\bin) compiled with MinGW. The items in path variable are looked up when your application starts. Suddenly the folder with "wrong" libraries exists before the folder with correct item in your path variable. What you can do is to copy QtCore4.dll, QtGui4.dll and other libraries that you need to folder with your application executable. Hope this helps.
Some links about this problem:
#qtforum.org
#some blog post (in Russian =))