Creating executable for Qt projects - linux

I have a Qt application that run on Linux. I want to have its executable such that it can operate on Windows too without Qt being installed. I have seen the older posts too regarding this but couldn't understand them. Please guide me step by step to create executable file.
I have placed all the necessary dlls alongside and was successful to run the executable. But to run it I need to go inside the folder and than do that.
How can I wrap my application, such that user has the set up for that, he installs it and then run that (usually we have for the S/ws). How can I do this for the Qt application?

Download the setup for Qt for Windows with MinGW compiler here.
Once you install Qt IDE on a Windows machine, make necessary changes to your project's .pro file and build your application.
Now copy the executable you created into a different folder and run a dependency check on it. You can use Dependency Walker which you can download from here. Copy the dlls shown in the Dependency walker and place it next to your application. You will find the required dlls in the Qt's bin folder in the installation directory. Path might be something like C:\Qt\Qt\\mingw\bin. You will also need to copy the gcc and mingw dlls into your application directory.
Next you will have to copy the required plugins into your application directory. You will need the platforms plugins, iconengines and imageformats if you are using icons, sqldrivers if your application connects to a database. Copy the directories of the required plugins into your application folder.
Once you copy all required libraries, you should be able to open the application. You can now distribute your application along with all these dynamic link libraries and plugins.
For more details you can refer this link.

You should place Qt DLLs along the release version of your executable. These are Qt5Core.dll, Qt5Gui.dll, Qt5Widgets.dll and possibly the ones for other modules that you have used. These dll files are in your installed Qt Directory in bin folder.
You should also place msvcr100.dll and msvcp100.dll in case you are using MSVS2010.
If you are using MinGW, place MINGWM10.DLL, LIBGCC_S_DW2-1.dll and LIBSTDC++-6.dll alongside the executable.
If you are using plugins you should place their dll in a folder named plugins beside your exe. In case of using icons and images you should ship their dlls like qico.dll and qsvg.dll in a folder named imageformats.
You should also put qwindows.dll in a folder named platforms alongside the executable.

Related

Where to "install" thirdparty libraries & header files to on Windows?

Where do you store your thirdparty libraries and header files to when developing C/C++ on Windows?
When developing on Linux the package managers usally installs thirdparty libraries to /usr/lib and /usr/include. So I know where to look for.
I am just starting to develop on Windows and made the mistake to install libraries to C:\Program Files which is a bad idea due to UAC and permission lookdown on Windows 10.
Is there some kind of best practice? Thanks in advance
Usually to one of these locations:
Commercial tools might have an installer and if so the location is indeed often Program Files [ (x86) ]
Libraries built from source (for example zlib for compression) go wherever you have your root folder for C++ projects. Using Visual Studio you might have a C: > VS17 folder with one sub-folder for each solution and each partner library. You then reference the H and LIB files using relative paths like ../../other-libraryname/include so that they will work if you move the VS17 library to a new drive or change its name.
In both cases, when building a setup package for deploying to another PC, you typically include only DLL files and code statically linked into your own EXE, you don't include H or LIB files. The default installation location for the setup will be Program Files, but if your third-party library includes COM objects they might recommend installing them to the Windows system32 folder.

OpenCV and CMake in Windows7: wrong include dir

I built my own OpenCV-2.4.10 libs for Windows 7 mingw:
1) download opencv-2.4.10 for Windows to f:\opencv-2.4.10\
2) cmake f:\opencv-2.4.10\source to f:\opencv-2.4.10\build\x86\mingw
3) generate f:\opencv-2.4.10\build\x86\mingw
4) mingw32-make f:\opencv-2.4.10\build\x86\mingw
When I create an eclipse project, I set the include dir to f:\opencv-2.4.10\build\include and lib dir to f:\opencv-2.4.10\build\x86\mingw\bin
Everything works fine. Now I want to process the same project on Windows and Ubuntu and I created a CMake project for this. Under Windows I can cmake my project but I can't compile because the include files can't be find. I found out, that in my CMake project the include dir is set to f:\opencv-2.4.10\source\include and not to f:\opencv-2.4.10\build\include, that has another directory structure.
Under Ubuntu the project is compiled and works. So I'm pretty sure, that the problem is with my OpenCV installation on Windows. What did I do wrong, since this is the proposed procedure by the opencv documentation?
f:\opencv-2.4.10\build\include
this holds the header files you want to include, it shouldn't matter if you are on windows or on Ubuntu

InstallShield installs to SysWOW64 and not in System32

I'm creating a InstallShield 2012 Spring project, and I need to copy some jpg into System32 subfolder.
In Application Data/Files and Folders, I put that into [WindowsFolder]/System32/akrmf and when install, it copies to SysWOW64/akrmf on Windows 7
The installation project doesn't include any exe or dll, only text files and images.
I tried using [SystemFolder] and copies into SysWOW64 too.
Is there any way to force installation into System32/akrmf folder ?
Thanks
To target the true (64-bit) system folder with Windows Installer, your MSI needs to be a 64-bit package (see Targeting 64-bit Operating Systems). Unfortunately this prevents it from installing on 32-bit systems.
To do this with InstallScript, there are related approaches that do not require creating two separate packages, but you may find it easiest to create two different components where only one is selected for installation.

Independent qt application and dependency packing in windows and linux

I made an application for Linux using QtCreator. The application uses two external libraries, qextserialport and qwt. I want to deploy the app such that all libraries it depends on are deployed alongside the executable file.
When I made an application for Windows I just copied the .dll files into the app.exe folder, and it works. But how do I do this on Linux?
In Linux you can:
1) static-link the dependencies
or
2) pack dependencies windows-style and set environment variable LD_LIBRARY_PATH pointing to the subdirectory containing the dynamic libraries
[updated]
read man ld, may be you will have to compile static versions of the libraries if they are not compiled by default (look at this tutorial if you can't tell the difference).
Great comment by synthesizerpatel, if the library uses autoconf (a lot of linux software do), it has options like --enable-shared and --enable-static.

Eclipse 3.5+: Loading plug-ins from auto-created .eclipse directory inside user's home directory

I have downloaded the latest Eclipse (3.6) for my Linux machine and extracted tar.gz to the /opt/eclipse directory as root. I started Eclipse as a normal user and successfully installed some plug-ins through Eclipse. The plug-ins are visible under "Installed software" from Eclipse, but they doesn't seem to be working - no new perspectives that should be there, no features, nothing.
Then I looked inside my home folder and found the following directory:
.eclipse/org.eclipse.platform_3.5.0_1473617060
That directory structure looks similar to the one in the /opt/eclipse (where Eclipse is installed) and has 4 directories inside ("dropins", "configuration", "plugins", "features") and one file ("artifacts.xml"). The "plugins" folder really containts all the plug-ins I have installed.
I have already read the following topic:
Installing Eclipse (3.4+) plugins in a directory other than ECLIPSE_HOME/plugins
and tried to put .link file in "opt/eclipse/dropins" and/or "opt/eclipse/links" directory pointing to the configuration directory in my home directory, but that doesn't seem to be working.
So these are the steps to reproduce the problem, in short:
Run Eclipse as some user which has no write permissions to installation dir
Install plug-ins through Eclipse and restart it (as the same user)
Eclipse now shows that those plug-ins are installed. The plugins are indeed located somewhere in the home directory of the user who installed them (~/.eclipse/.../plugins).
Problem: plug-ins are somehow ignored.
I know that I can quick-fix the problem by copying the plugins manually to the installation directory (as a root) each time I install a plug-in as a non-root (or always install plug-ins as root), but I am interested in the way how can I configure Eclipse to read the user's own configuration file and plugins which have been automatically generated by Eclipse in the first place.
Any ideas how can I force Eclipse to actually use the plug-ins installed by Eclipse?
This sounds like a p2 bug. Can you open a bug report?

Resources