Details
-
User Story
-
Resolution: Done
-
P1: Critical
-
None
-
None
Description
Currently when building and running a CMake Qt application using a static build of Qt, you get the following error:
qt.qpa.plugin: Could not find the Qt platform plugin "cocoa" in "" This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem
This is because during a static build, plugins have to be explicitly initialised from within code by using the Q_IMPLORT_PLUGIN() macro.
See https://doc.qt.io/QtForDeviceCreation/qtee-static-linking.html#building-a-static-application
This is done automatically by qmake, but not by CMake.
There is a pending patch at https://codereview.qt-project.org/#/c/243731/22 which adds such functionality for the CMake files created by qmake.
We should add the same to the CMake files which are generated for the CMake Qt build which are then consumed by a CMake application.
Perhaps something can be reused there.
Attachments
Issue Links
- relates to
-
QTBUG-74132 Implement initial building of qtbase modules statically
- Closed