Deploying Qt application on Windows/Linux, developing on MacOS - c++

I am trying to send my current program to a colleague. He's on Linux, I'm on MacOS. The result of my release build is an .app file. I would like to have a binary executable through ./binary. There's a Makefile in the folder, but it throws make: Nothing to be done for 'first'., so I guess I can't use that.
I am running Qt 5.4.1, Qt Creator 3.4.0. Compiling through GCC/CLANG.
Is there a way to do this?

Related

CMake: Qt Project to CLion with MSVC 2017

I'm having a project in Qt Creator and I'm trying to port it into CLion but I found myself blocked into some problems. If any of you could help me to port this CMake project I would really appreciate it.
Qt Creator
So, here is my setup for the Qt Creator project first:
Qt: 5.14.2
Compiler: MSVC 2017 64-bits
Also, here are my custom paths and my build environment:
Also, the build (install) time in Qt Creator takes around 20-30minutes.
CLion
Now in terms of CLion and what I've tried here are the following.
and in terms of setting up the CMake:
I've also added the paths into Environment Variables from CLion
But the problem arises when I'm trying to compile the project.
I'm going to install the project via Build -> Install
After that, I need to wait for around 1h or more(even if in Qt Creator is going to take just 20-30min) to a point where the build will fail and I will receive the following error message
MASM : fatal error A1000: cannot open file : 4 [C:\PRJOJECT_NAME\build_clion\components\extern_crashpad\crashpad\util\crashpad_util.vcxproj]
but if I'm searching for that file, it exists in that folder which is specified. But the problem is that I don't understand why the same project if build with Qt Creator is working but not vice versa. Could any of you help me to understand what I'm doing wrong?
It looks like QT Creator is using Ninja as a generator and CLion is using MSVC.
Try -G Ninja in your CLion CMake Options text box. Make sure Ninja is in a path accessible by CMake.

Qt cannot load cocoa plugin

I'm trying to compile and run an application on a MacBook using Qt Creator. There are no issues compiling the project, but when I try and run it, it seems to be unable to load a plugin.
Could not load the Qt platform plugin "cocoa" in "" even though it was found.
The application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
This error occurs both when trying to run the application from Qt Creator or via Finder. It seems to only happen when I use the CMake build system (no issues when using QMake), but my existing project that I need to deploy on MacOS uses CMake.
My steps to reproduce are:
Install a completely clean MacOS (no user data)
Install Xcode 11
Install CMake 3.15
Install Qt 5.13.1 MacOS package
Open QtCreator->New Project->Qt Quick Application - Scroll
Set build system to CMake (important)
Compile and notice error
I am using:
Qt 5.13.1
macOS Catalina 10.15
Apple Clang 11
I recognize that for final user deployment I will need to use the macqtdeploy tool to copy the Qt libraries to the executable folder, but I should be able to run my app from QtCreator without doing this? Especially as it works fine when using QMake.
So it ended up being some kind of name resolution thing where Qt Creator couldn't decide whether to use the debug or release versions of the framework. Supplying DYLD_IMAGE_SUFFIX=_debug fixed this (add this to the environment section under Kits).

The process "mingw32-make.exe" crashed Error

I have downloaded qt-windows-opensource-5.0.1-mingw47_32-x86-offline.exe and installed on my system, after that i launched QT Creator and tried to run a QML based example (shipped example is "QtQuick Examples - MouseArea" which tried, and below problem comes with any example i try to run) which was supplied with along with the whole package.
When i try to run the project i get below log...
13:00:20: Running steps for project mousearea...
13:00:20: Configuration unchanged, skipping qmake step.
13:00:20: Starting: "mingw32-make.exe"
qtcreator_ctrlc_stub: Command line failed: mingw32-make.exe
13:00:20: The process "mingw32-make.exe" crashed.
Error while building/deploying project mousearea (kit: Desktop Qt 5.0.1 MinGW 32bit)
When executing step 'Make'
Do you have mingw47_32 installed? The Qt you download needs the very same compiler the Qt libraries where compiled with, and that is the one that appears in the name of the download.
So my guess is that you're compiling with some other mingw which is not version 4.7 / 32 bits. Download that version, point Qt to it in Tools >> Options >> Kits. Rebuild then.
The problem was resolved later on, I installed qt-windows-opensource-5.0.1-mingw47_32-x86-offline.exe on 64bit system and that's why mingw32-make.exe crashed, downloading appropriate QT for 64bit system solve the problem.

The program has unexpectedly finished - QT creator

I am trying to use QT creator to develop GUI/Console applications using QT framework. I am using windows XP. I installed QT 4.8.3 and mingw. Both are installed without any error.
And then I installed QT creator.
QT Version: Qt 4.8.2 in PATH (4.8.2)
Mingw(manual)
Compiler path: C:\MinGW\bin\g++.exe
Debugger path: C:\MinGW\bin\gdb.exe
mkspec: win32-g++
EnvironmentVariables:
QTDIR, PATH, MinGW,
PATH includes 4.8.2\bin; mingw\bin
INCLUDE : 4.8.2\include
When i try to develop an application using qt creator, it has been built properly and binary is also generated without any error.
But when I try to run the application, It is crashed saying that
The program has unexpectedly finished.
C:\Qt\4.8.2\examples\widgets\analogclock-build-desktop-Qt_4_8_2_in_PATH__4_8_2__Debug\debug\analogclock.exe exited with code -1073741819
This crash came for example application provided by QT library( it is analog clock)
Please try to help me in this, Do I need to set any variables or other
Thank alot.
I had exactly the same problem and solved it yesterday.
If the output of g++ --version doesn't say something like 4.4, this is binary incompatibility. You'll have to get MinGW 4.4. It is included in QtSDK, or at least was.
Next, configure your QtCreator settings ("Build & Run > Toolchains").

How to compile Qt statically under Windows?

After successfully installing the Qt SDK 4.7.4 (MingW) and building an application I can find no way to deploy my program. Qt is really nice, but to deploy under Windows means to leave he surfaced road.
First the executable requires QtCore4.dll plus some other DLLs, but the Creator does not copy them into the deploy folder. Do I really have to try DEPENDS.EXE, to find out which DLLs are required, and then cull them manually from somewhere under C:/QtSDK?
Be that as it may, preferably I want to link statically. There are few recipes on the net how this can be done (e.g. here and here). So I launched a Qt 4.7.4 Desktop (MingW) command prompt. The Qt Reference Documentation tells to run CONFIGURE.EXE, but there's no CONFIGURE.EXE and no CONFIGURE.CMD, not under C:/QtSDK and not under C:/.
What am I missing?