Error when trying to deploy Qt application using shared libraries - c++

I tried to deploy a qt application using the shared library approach described here: http://doc.qt.io/qt-5/linux-deployment.html (5th headline)
When I go to my project folder and type "make clean" I get this error: "make: *** No rule ro make target 'clean'. Stop"
What is the problem here?
Also: The documentation states: "We assume that you already have installed Qt as a shared library, which is the default when installing Qt, in the /path/to/Qt directory."
How can I check if I installed Qt as a shared library?
I wrote the application in C++ using the Qt Creator on a Raspberry Pi 2 with Raspbian Jessie. I want to deploy it so I can use it on another Raspberry that has minimal functionality without desktop-gui or qtcreator installed. I am using Raspbian Jessie Lite on that one.

Before running make you should have Makefile there. If you don't, run qmake to generate one. If qmake fails, you've done something really wrong with .pro file.

Related

How to install Qt Serialport on macOS?

I'm trying to compile this code where the .pro file includes a
QT += serialport
gives me a
Project MESSAGE: Warning: unknown QT: serialport
error. Without Qt, I would use CMake and install the package via vcpkg, Conan, HomeBrew, or something like that. But not sure if Qt has its own package manager. I would appreciate it if you could help me know what is the most canonical way to install and include this library.
P.S.1. In the comments, I'm being told that I need to use Qt's Maintenance Tool, which is sorta the internal package manager for Qt, to install QtSerialPort module. Given that I don't know how to install that via HomeBrew, I installed Qt Creator from the Qt website. I found the Maintenance Tool in <install_dir> the installation folder /Users/<user>/Qt/MaintenanceTool.app which I could open from the terminal by open MaintenanceTool.app while being in that folder. However, I can not see any QtSerialPort module in the options, nor a way to search.
P.S.2. Posted a new question here.
P.S.3. I think this issue arises because I had multiple versions of Qt installed. once I searched for locate qmake and found out the other versions I have installed (e.g., /System/Volumes/Data/usr/local/Cellar/qt/5.14.1/bin/qmake) I could just run that and the MakeFile was generated.

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).

No configure file to make static version of qt

I want to deploy my qt program using static linking following this documentation:
http://doc.qt.io/qt-5/linux-deployment.html
When I try the command "./configure -static -prefix /usr/bin", I get an error:
"bash: ./configure: No such file or directory"
I understand that happens because there is no configure file. In the documentation it says "/path/to/Qt". /usr/bin seems to be the path where qt is installed.
Why is it not working? Am I in the wrong directory?
I wrote the application in C++ using the Qt Creator on a Raspberry Pi 2 with Raspbian Jessie. I want to deploy it so I can use it on another Raspberry that has minimal functionality without desktop-gui or qtcreator installed. I am using Raspbian Jessie Lite on that one.
I had this same problem after installing qt creator 5.10.
The qt directory does not have a configure file. However, the source directory for qt does.
In my installation, that is:
~/qt/5.10.1/Src
If you cd into that directory, you can run the ./configure command. At least i am able to.

Unable to build for Windows on Linux, with MinGW

Because I am not a Java enthusiast, I decided to use C++ and Qt for one of my projects. However, I came across the big cross-compiling Qt problem, and I am unable to produce an .exe file for Windows users.
My setup
Linux Ubuntu 12.04, with Wine and Qt. qmake -v gives the following output :
QMake version 2.01a
Using Qt version 4.8.1 in /usr/lib/x86_64-linux-gnu
I also have a MinGW32 compiler, which can be found at /usr/bin/i586-mingw32msvc-g++. My Wine drive_c folder contains the following Qt directories :
$HOME/.wine/drive_c/Qt/Qt5.2.0/5.2.0/Src
$HOME/.wine/drive_c/Qt/Qt5.2.0/5.2.0/mingw48_32
The mingw48_32 directory contains the necessary include/ and lib/ directories, which are used in my mkspec file, /usr/share/qt4/mkspecs/win32-x-g++/qmake.conf :
QMAKE_INCDIR_QT = /home/me/.wine/drive_c/Qt/Qt5.2.0/5.2.0/mingw48_32/include
QMAKE_LIBDIR_QT = /home/me/.wine/drive_c/Qt/Qt5.2.0/5.2.0/mingw48_32/lib
The problem
According to most guides I've found about Qt cross-compiling, my setup should be enough to run a simple :
qmake -spec win32-x-g++
make
wine /path/to/my/application.exe
But... nothing's linked. QApplication and every other symbol I use in my program are "not found". No QApplication, no QPushButton, no connect(), no SIGNAL(), no SLOT()...
My objective here is to successfully configure QtCreator to use this setup (in an independent build configuration), so that it can build a Linux executable (through the first and working configuration), and a Win32 .exe (through the MinGW setup above). However, I cannot modify a single build step in QtCreator :
Cannot add a "MinGW" toolchain : it is not available in the "Add" dropdown list.
Cannot change the -spec parameter value in the project build configurations panel. The field is non-editable.
Despite guides and solutions I found all over the Internet, my only solution so far is to send my source code to a virtual Windows machine, and have it create a new project with it. On this VM, I could probably compile for Windows... But of course, this doesn't actually sound like a real "solution" to me...
Is there any way Qt(Creator) has finally made cross-compiling easier now ? I'm getting a bit tired of "symbol not found" errors...
First,
sudo apt-get install mingw-w64
Then, check if Qt Creator finds the toolchain.
Next, until Ubuntu starts providing a mingw-w64-qt package, download the Qt source and build it. This is bound to get messy, and maybe even the simplest thing to do is to install WINE and use a Windows Qt version.

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?