I want to create an installer for my Application. So, I have read about Qt Installer Framework and I tested the tutorial example and create the installer and everything work find with the example. But I have a doubt when I try to do the same process for my Application. When I compile the code a folder is created at the same level of my code:
MyApplication (my code)
build-MyApplication-Desktop_Qt_5_4_1_MinGW_32bit-Release (code compiled)
So my questions are:
What files of the compilation do I need to copy into the folder myinstaller/packages/vendor/ recommended by Qt Intaller Framework?
If I have dependencies of Qt like serialport, multimedia, and others, how do I insert these dependecies with Qt Installer Framework?
windeployqt.exe is what you want. Just run that on the command line and give it your executable as the argument. It will automatically copy in all the required Qt libraries and even provide the runtime redistributable installer. Then you can use the binarycreator to generate an installer.
You can put all the dependencies in myinstaller/packages/vendor/data, along with your exe. and eventual additional files. I recommended using i.e. dependency walker for finding all the required dependencies. Some of the binarycreator tutorials on qt are outdated; make sure you use the command
<location-of-ifw>\binarycreator.exe -t <location-of-ifw>\installerbase.exe -p <package_directory> -c <config_directory>\<config_file> <installer_name>
with the appropriate arguments.
Related
I was trying to create a exe file of my Qt project.
I found this post: How to create executable file for a Qt Application?
and realised that i dont have a mingwm10.dll file in that directory.
Are there any other ways of creating a exe file or any other location where mingwm10.dll might be located?
I am using qt 5.6.
mingwm10.dll is a runtime file for the MinGW.org toolchain. Qt moved towards a MinGW-w64-based toolchain (which is essentially an expanded and newer implementation of the Win32 headers and import libraries), which doesn't have this runtime dependency. Ignore it, you don't need it. You might need the libgcc and libstdc++ DLLs though, but that's the same with any (non-statically built) toolchain.
Note you can use the windeployqt utility to automatically copy over all runtime depencies of an executable. You can enable it by adding windeployqt to CONFIG if you're using qmake, or you could just run it yourself:
windeployqt my_app.exe
This command will copy all DLLs (including the Qt platform plugins etc.) so that the application can be run by e.g. double-clicking, instead of only in the specific environment of an IDE.
In one of my programs I use QWebView to load and print reports made from HTML documents. So while deployment I copy these libraries, in additional to all other relevant Qt libraries:
Qt5WebKit.dll
Qt5WebKitWidgets.dll
Qt5PrintSupport.dll
plugins/printsupport/windowsprintersupport.dll
After testing on destination machine I've found that printing doesn't work. Thanks for Dependency Walker I've get all the missed libraries. Here is the list:
Qt5Multimedia.dll
Qt5Positioning.dll
Qt5MultimediaWidgets.dll
Qt5Qml.dll
Qt5Quick.dll
Qt5Sensors.dll
Qt5OpenGL.dll
Ok, I can understand why it wants Qt5Multimedia.dll. Browser can play sound etc. But QML! Why I need all these libraries related to QML?? I don't use neither OpenGL nor sensors or positioning. So it's just unnecessary in my case.
And so my question - is there way to deploy only libraries I need in actual fact? And get the program work of course.
I would suggest you to use windeployqt.exe.
From the docs:
The Windows deployment tool can be found in QTDIR/bin/windeployqt. It
is designed to automate the process of creating a deployable folder
that contains all libraries, QML imports, plugins, translations that
are required to run the application from that folder. This is used to
create the sandbox for Windows Runtime or an installation tree for
Windows desktop applications that can be easily bundled by an
installer.
This is how I do:
cd [my program dir]
mkdir RELEASE
cd RELEASE
copy ..\"progname.exe" .
set QTDIR=C:\Qt\Qt5.4.1\5.4\mingw491_32\bin
call %QTDIR%\qtenv2.bat
windeployqt --force "progname.exe"
You could adapt that for your need by changing [my program dir] to your application's folder (containing the .exe file), QTDIR to your Qt MinGW folder (that's what I use) and progname.exe with the name of your executable file.
It will create a release directory with your executable and the needed Qt libraries (.dll's, etc).
I have made an application using QtWebKit, Qt4. I have the binary generated in Fedora 16. Now, I want to run that application on another PC (running some other Fedora version), where Qt is not installed. How can I package my Qt application so that it can run on a platform where Qt is not installed? Is there any command line utility as well as QtCreator utility to do so. I have tried "deploy all" command, but it didn't have any affect.
Create an Installer with the Qt Installer Framework and just supply all needed shared libraries (Win/OSX) or compile statically. Under Linux there is always the problem between system-wide libraries or bundled libraries. The documentation https://qt-project.org/doc/qt-5.0/qtdoc/deployment.html should give you a good start
Obviously, you need to have access to the qt libraries, which are exactly the same version that you used to compile your application.
There are two options :
link qt libraries statically
create a RPM package (see this how)
Also check Deploying Qt Applications.
Since you're deploying using rpm, to systems where Qt 4 rpms are available, you don't need to do anything besides simply adding a dependency on the qt to your rpm's specfile. The user installing your package using yum localinstall will get the Qt dependencies automatically installed. That's the correct way of doing it - it will keep your package size small.
Of course you need a separate rpm build for every fedora/centos major version out there, but that's almost always a requirement.
If your package needs newer Qt version than the one provided by the platform packages, you can still make a specific version dependency (say qt >= 4.7.0) and have a readme that indicates that newer packages can be obtained from a 3rd party repository (epel etc.)
For deployment under Linux I've used Bitrock Installer Tool.
The main thing before deploying is to check your dependencies. You can do that by using command:
ldd appName | grep libQt
After that you'll see list of dependencies. You'll have to set environment variable LD_LIBRARY_PATH to let linker know where're your libraries. To do that:
export LD_LIBRARY_PATH=.
. means current directory
And after that:
./appName $*
After that you'll be able to use your executable with Bitrock Installer Tool.
I have ported an existing Qt4 application Qt5 and added some extra (simple) functionality to this application.
The old application came with
libgcc_s_dw2_1.dll
libusb-1.0.dll
mingwm10.dll
QtCore4.dll
QtCored4.dll
QtGui.dll
Now, from QtCreator I am able to run my modified application, but problems occur when preparing deployment. I have used dependancy walker on my .exe and included a load of DLL's in my executables directory.
icudt51.dll
icuin51.dll
icuuc51.dll
IEShims.dll
libgcc_s_dw2-1.dll
libGLESv2.dll
libstdc++-6.dll
libusb-1.0.dll
libwinpthread-1.dll
mingwm10.dll
Qt5Core.dll
Qt5Cored.dll
Qt5Gui.dll
Qt5Guid.dll
Qt5Widgets.dll
Qt5Widgetsd.dll
QtCored4.dll
(Yes, the project size is now extremely large due to the DLL's, but in my use case this is not an issue.)
And finally it didn't complain about missing DLL's. The error message posted when trying to execute the .exe is:
The procedure entry point ?testBit#QBitArray##QBE_NH#Z could not be located in the dynamic link library Qt5Core.dll
I have never tried executing a Qt application outside Qt Creator, so I have really no idea what to do.
If it helps:
Under Projects-> qmake build config : Release -> Effective qmake call I have
qmake.exe D:\Product\test_util.pro -r -spec win32-g++
If any more information is required to make anything more clear, please leave a comment about it.
I had the same problem on Qt 5.4.2 after slightly modifying my code to add new functionality depending on OpenGL. What I did was use Qt's Window's Deployment tool.
Create a folder and place your binary in it
Using cmd issue the following command depending on which version of binary you have:
windeployqt --release Name_Of_Binary
windeployqt --debug Name_Of_Binary
Depending on which version of Qt Creator you have, you might have to manually copy the lib*.dll's to the directory. This bug is not present in Qt 5.4.2 but was present in earlier versions.
I want to build some KDE applications. Here's what I did so far:
sudo apt-get install kde-full
add LIBS += -lkdeui in the .pro file of a project which used KDE libraries.
I am using the QtCreator and the above mentioned steps don't seem to be enough. Error message: KApplication: no such file or directory.
What are the steps to configure my system for KDE application development?
The recommended way to build a KDE project is use CMake, not QMake. I really recommend you this approach because some KDE applications, like plasmoids, can not be build correctly using QMake.
In addition you can use KDevelop, but if you prefer Qt Creator, you can use it with a CMake project without problems.
http://techbase.kde.org/Development/Tutorials/CMake
KApplication.h is typically located in /usr/include/KDE folder. Make sure you have it in your include path (i.e. INCLUDEPATH += /usr/include/KDE).