Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't build a static Qml app with CMake #3037

Open
I-dont-need-name opened this issue Dec 26, 2023 · 0 comments
Open

Can't build a static Qml app with CMake #3037

I-dont-need-name opened this issue Dec 26, 2023 · 0 comments

Comments

@I-dont-need-name
Copy link

I have a relatively simple qml app which I want to build statically for windows from Linux.

I have a rather default CMakeLists.txt file.
On the internet I found, that I need qt_import_qml_plugins() to import plugins for QML.
Adding this CMake command creates a new file in the build directory with following content:

// This file is autogenerated by CMake. It imports static plugin classes for
// static plugins used by QML imports.
#include <QtPlugin>

Q_IMPORT_PLUGIN(QtQuick2Plugin)
Q_IMPORT_PLUGIN(QtQuick2WindowPlugin)
Q_IMPORT_PLUGIN(QtQuickControls2Plugin)
Q_IMPORT_PLUGIN(QtQmlPlugin)
Q_IMPORT_PLUGIN(QtQuickTemplates2Plugin)
Q_IMPORT_PLUGIN(QtQmlModelsPlugin)
Q_IMPORT_PLUGIN(QtQmlWorkerScriptPlugin)
Q_IMPORT_PLUGIN(QMultimediaDeclarativeModule)
Q_IMPORT_PLUGIN(QtQuickControls2ImagineStylePlugin)
Q_IMPORT_PLUGIN(QtGraphicalEffectsPlugin)
Q_IMPORT_PLUGIN(QtGraphicalEffectsPrivatePlugin)
Q_IMPORT_PLUGIN(QtQuickControls2MaterialStylePlugin)
Q_IMPORT_PLUGIN(QtQuickControls2FusionStylePlugin)
Q_IMPORT_PLUGIN(QtQuickControls2UniversalStylePlugin)

But when I run make I get a wall of undefined reference errors like:

/home/user/git/mxe/usr/bin/i686-w64-mingw32.static-ld: /home/user/git/mxe/usr/i686-w64-mingw32.static/qt5/qml/QtQuick.2/libqtquick2plugin.a(plugin.o):plugin.cpp:(.text$_ZN14QtQuick2Plugin13registerTypesEPKc[__ZN14QtQuick2Plugin13registerTypesEPKc]+0x12): undefined reference to `QQmlWorkerScriptModule::registerQuickTypes()'
/home/user/git/mxe/usr/bin/i686-w64-mingw32.static-ld: /home/user/git/mxe/usr/i686-w64-mingw32.static/qt5/qml/QtQuick.2/libqtquick2plugin.a(plugin.o):plugin.cpp:(.text$_ZThn8_N14QtQuick2Plugin13registerTypesEPKc[__ZThn8_N14QtQuick2Plugin13registerTypesEPKc]+0x12): undefined reference to `QQmlWorkerScriptModule::registerQuickTypes()'

All of them seem to arise from Q_IMPORT_PLUGIN Macro (or whatever it is). What am I doing wrong? Any help much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant