'Unknown module(s)' error building Qt project (with subprojects) in Yocto
-
I am trying to write a Yocto recipe for qthttpserver (https://github.com/qt-labs/qthttpserver, 5.15 branch). Here's what I have so far ('qthttpserver_5.15.bb'):
SUMMARY = "qthttpserver recipe" DEPENDS = "qtbase qtwebsockets" LICENSE = "GPL-3.0-only" LIC_FILES_CHKSUM = "file://LICENSE.GPL3;md5=d32239bcb673463ab874e80d47fae504" SRC_URI = "gitsm://github.com/qt-labs/qthttpserver.git;protocol=https;branch=5.15" SRCREV = "52bce52413763ead7759f8c2e374a40bb82f058f" S = "${WORKDIR}/git" inherit qmake5 do_install() { install -d ${libdir} cp ${S}/lib/* ${libdir}/ } FILES:${PN} += " \ ${libdir}/* \ "
This fails with
Project ERROR: Unknown module(s) in QT: sslserver
(presumably because the sslserver subproject is not getting built first?).If I try to manually run the build from a terminal (in the 'build' directory) with
../recipe-sysroot-native/usr/bin/qmake ../git/qthttpserver.pro -spec linux-g++ ../recipe-sysroot-native/usr/bin/make -f Makefile qmake_all
then I get
Project ERROR: Unknown module(s) in QT: gui
. The 'gui' module is not referenced in the project anywhere that I can find.If I try to manually run the build (from a terminal, in the 'build' directory) with the 'system' qmake
"/opt/Qt/5.15.2/gcc_64/bin/qmake" ../git/qthttpserver.pro -spec linux-g++ ../recipe-sysroot-native/usr/bin/make -f Makefile qmake_all
then it builds fine.
What is going on here?
-
Looking a bit more closely, it seems like sslserver is optional; src.pro contains the following:
qtConfig(ssl) { SUBDIRS += sslserver httpserver.depends = sslserver }
and there are similar conditionals in the httpserver project:
#if QT_CONFIG(ssl) #include <QtSslServer/qsslserver.h> #include <QSslCertificate> #include <QSslKey> #endif
Solved by adding
require ../../../meta-qt5/recipes-qt/qt5/qt5.inc
to the recipe (and removinginherit qmake5
, as it's included in qt5.inc in any case).Made some progress by setting
OE_QMAKE_RECURSIVE = ""
but then was struggling with the installation part, and eventually realised that just requiring qt5.inc solved everything. -
I am trying to write a Yocto recipe for qthttpserver (https://github.com/qt-labs/qthttpserver, 5.15 branch). Here's what I have so far ('qthttpserver_5.15.bb'):
SUMMARY = "qthttpserver recipe" DEPENDS = "qtbase qtwebsockets" LICENSE = "GPL-3.0-only" LIC_FILES_CHKSUM = "file://LICENSE.GPL3;md5=d32239bcb673463ab874e80d47fae504" SRC_URI = "gitsm://github.com/qt-labs/qthttpserver.git;protocol=https;branch=5.15" SRCREV = "52bce52413763ead7759f8c2e374a40bb82f058f" S = "${WORKDIR}/git" inherit qmake5 do_install() { install -d ${libdir} cp ${S}/lib/* ${libdir}/ } FILES:${PN} += " \ ${libdir}/* \ "
This fails with
Project ERROR: Unknown module(s) in QT: sslserver
(presumably because the sslserver subproject is not getting built first?).If I try to manually run the build from a terminal (in the 'build' directory) with
../recipe-sysroot-native/usr/bin/qmake ../git/qthttpserver.pro -spec linux-g++ ../recipe-sysroot-native/usr/bin/make -f Makefile qmake_all
then I get
Project ERROR: Unknown module(s) in QT: gui
. The 'gui' module is not referenced in the project anywhere that I can find.If I try to manually run the build (from a terminal, in the 'build' directory) with the 'system' qmake
"/opt/Qt/5.15.2/gcc_64/bin/qmake" ../git/qthttpserver.pro -spec linux-g++ ../recipe-sysroot-native/usr/bin/make -f Makefile qmake_all
then it builds fine.
What is going on here?
-
@jsulm sslserver is one of the subprojects. Adding it to DEPENDS just errors out, presumably because it hasn't been built yet at the time the recipe is run. It seems that perhaps if sslserver was built before httpserver then that might solve the problem (as httpserver does depend on sslserver), but I have no idea how any of that is decided behind the scenes and why it works under some scenarios (e.g. when built from QtCreator, or using specific terminal commands as mentioned).
The project structure is:
├── qthttpserver.pro ├── examples │ ├── examples.pro │ └── httpserver │ ├── httpserver.pro │ └── simple │ └── simple.pro ├── src │ ├── src.pro │ ├── 3rdparty │ │ ├── http-parser │ │ │ └── Makefile │ │ └── http-parser.pri │ ├── httpserver │ │ └── httpserver.pro │ └── sslserver │ └── sslserver.pro └── tests ├── auto │ ├── auto.pro │ ├── cmake │ │ ├── CMakeLists.txt │ │ ├── abstracthttpserver │ │ │ └── CMakeLists.txt │ │ └── cmake.pro │ ├── qabstracthttpserver │ │ └── qabstracthttpserver.pro │ ├── qhttpserver │ │ └── qhttpserver.pro │ ├── qhttpserverresponder │ │ └── qhttpserverresponder.pro │ ├── qhttpserverresponse │ │ └── qhttpserverresponse.pro │ └── qhttpserverrouter │ └── qhttpserverrouter.pro └── tests.pro
-
@jsulm sslserver is one of the subprojects. Adding it to DEPENDS just errors out, presumably because it hasn't been built yet at the time the recipe is run. It seems that perhaps if sslserver was built before httpserver then that might solve the problem (as httpserver does depend on sslserver), but I have no idea how any of that is decided behind the scenes and why it works under some scenarios (e.g. when built from QtCreator, or using specific terminal commands as mentioned).
The project structure is:
├── qthttpserver.pro ├── examples │ ├── examples.pro │ └── httpserver │ ├── httpserver.pro │ └── simple │ └── simple.pro ├── src │ ├── src.pro │ ├── 3rdparty │ │ ├── http-parser │ │ │ └── Makefile │ │ └── http-parser.pri │ ├── httpserver │ │ └── httpserver.pro │ └── sslserver │ └── sslserver.pro └── tests ├── auto │ ├── auto.pro │ ├── cmake │ │ ├── CMakeLists.txt │ │ ├── abstracthttpserver │ │ │ └── CMakeLists.txt │ │ └── cmake.pro │ ├── qabstracthttpserver │ │ └── qabstracthttpserver.pro │ ├── qhttpserver │ │ └── qhttpserver.pro │ ├── qhttpserverresponder │ │ └── qhttpserverresponder.pro │ ├── qhttpserverresponse │ │ └── qhttpserverresponse.pro │ └── qhttpserverrouter │ └── qhttpserverrouter.pro └── tests.pro
Looking a bit more closely, it seems like sslserver is optional; src.pro contains the following:
qtConfig(ssl) { SUBDIRS += sslserver httpserver.depends = sslserver }
and there are similar conditionals in the httpserver project:
#if QT_CONFIG(ssl) #include <QtSslServer/qsslserver.h> #include <QSslCertificate> #include <QSslKey> #endif
-
Looking a bit more closely, it seems like sslserver is optional; src.pro contains the following:
qtConfig(ssl) { SUBDIRS += sslserver httpserver.depends = sslserver }
and there are similar conditionals in the httpserver project:
#if QT_CONFIG(ssl) #include <QtSslServer/qsslserver.h> #include <QSslCertificate> #include <QSslKey> #endif
Solved by adding
require ../../../meta-qt5/recipes-qt/qt5/qt5.inc
to the recipe (and removinginherit qmake5
, as it's included in qt5.inc in any case).Made some progress by setting
OE_QMAKE_RECURSIVE = ""
but then was struggling with the installation part, and eventually realised that just requiring qt5.inc solved everything. -