Qt6.1.2 static cmake linux
-
I'm trying to use Qt6.1.2 static for my cmake project on Ubuntu (20.04)
First of all, shared libs Qt6.1.2 works ok for this project but I want use static. This project also works with Qt5.15.2 static.- Due to guides I'm building -static from sources:
$ mkdir build $ cd build $ ../qt-everywhere-src-6.1.2/configure -static -prefix /path/to/install $ cmake --build . --parallel 4 $ cmake --install .
on the "cmake --build" its failed whith an error "directory non exist" so I create a directory by myself - mkdir build/qtbase/src/corelib/.rcc
I think its a first bug, please add this mkdir into code, or explane how to do this steps correct.- When I'm trying to build my project using this static Qt6.1.2 I see next errors while linking:
/usr/bin/ld: 3rdparty/Qt/qt6/gcc_64/lib/libQt6Widgets.a(qapplication.cpp.o): in function `QApplicationPrivate::init()': qapplication.cpp:(.text._ZN19QApplicationPrivate4initEv+0xe): undefined reference to `qInitResources_qstyle()' /usr/bin/ld: qapplication.cpp:(.text._ZN19QApplicationPrivate4initEv+0x13): undefined reference to `qInitResources_qmessagebox()' /usr/bin/ld: 3rdparty/Qt/qt6/gcc_64/lib/libQt6Gui.a(qpdf.cpp.o): in function `QPdfEnginePrivate::QPdfEnginePrivate()': qpdf.cpp:(.text._ZN17QPdfEnginePrivateC2Ev+0x2d0): undefined reference to `qInitResources_qpdf()' collect2: error: ld returned 1 exit status make[2]: *** [CMakeFiles/build.make:237: ] Error 1 make[1]: *** [CMakeFiles/Makefile2:338: CMakeFiles/all] Error 2 make: *** [Makefile:84: all] Error 2
I've spent a tons of time to find out what I'm doing wrong, I thought about some dependesies I've miss etc.
Than I found this undefined references by paths:build/qtbase/src/widgets/.rcc/qrc_messagebox.cpp build/qtbase/src/widgets/.rcc/qrc_qstyle.cpp build/qtbase/src/widgets/.rcc/qrc_qstyle1.cpp build/qtbase/src/gui/.rcc/qrc_qpdf.cpp
I just took these 4 files and built them into my project. errors are gone.
It seems to me, these files should be a part of the libQt6Core.a but for some reason they don't get there if you build using -static
I think its a second bug or explain me how to solve this errors correctly, please.- After all my tries I built my project ok, got a binary file. But when I'm trying to run it I got an error:
FactoryLoader::QFactoryLoader() ignoring "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3" since plugins are disabled in static builds qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in "" This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem. Aborted (core dumped)
Please help me with it. How to fix this? How it should works generally?
-
-
@Jonas-Kvinge, I tried your suggestion and as a result of configure I see:
CMake Warning: Manually-specified variables were not used by the project: BUILD_qpdf
As far as I understand, that means there is no option -skip qpdf in configure ?!
I've already tried -skip qtwayland and if its applied, there is no such print.
Are you sure this option is correct?
upd: anyway I tried, result and errors same. -
Hi,
The module names are "qtXXX". So it's "qtpdf".
-
Sorry, I just realized that it's unrelated to that module.
The issue is within the qtbase module. So you might want to disable the pdf support in that module or possibly build a more recent version of Qt.
-
Did you check the bug report system ?