I am trying to build a custom QT application. However bitbake
is unable to find the application, while building rootfs
.
I tried a number of things:
ALLOW_EMPTY_${PN}
FILES_${PN}
_
and -
from application nameIMAGE_INSTALL += qtsimplecalc
. If I remove this, it builds, but the application is missing from rootfs
.Here is qtsimplecalc.bb
SUMMARY = "Qt Simple Calculator Application Recipe"
DESCRIPTION = "This recipe builds a Qt project for a simple calculator application."
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
DEPENDS += "qtbase"
FILESEXTRAPATHS += "${THISDIR}/${PN}:"
FILESEXTRAPATHS += "${THISDIR}/files:"
#SRC_URI = "https://github.com/vpapadopou/qt-simple-calculator.git"
#SRCREV = "${AUTOREV}"
#SRC_URI[sha256sum] = "1eb04ab58f54c11bffa00262b387aeab5e60ef6b42e3cbf88e23c026eb5c28d5"
SRC_URI = "file://main.cpp \
file://mainwindow.cpp \
file://mainwindow.h \
file://mainwindow.ui \
file://simpleCalculator.pro \
"
S = "${WORKDIR}"
do_install () {
install -d ${D}/opt/qtsimplecalc/
install -m 0755 simpleCalculator ${D}/opt/qtsimplecalc/
}
FILES_${PN} += "/opt/qtsimplecalc/simpleCalculator"
#ALLOW_EMPTY_${PN} = "1"
inherit qmake5
My directory structure looks like:
conf/
-- layer.conf
recipes-core/
recipes-example/
recipes-project/
recipes-qt-simple-calc/
-- qtsimplecalc
-- files
-- LICENSE.md
-- main.cpp
-- mainwindow.cpp
-- mainwindow.h
-- mainwindow.ui
-- README.md
-- screenshots
-- simpleCalculator.pro
-- qtsimplecalc.bb
recipes-rpilinux/
files directory contains source code from github : https://github.com/vpapadopou/qt-simple-calculator
conf/layer.conf
file:
# We have a conf and classes directory, add to BBPATH
BBPATH .= ":${LAYERDIR}"
# We have recipes-* directories, add to BBFILES
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
${LAYERDIR}/recipes-*/*/*.bbappend"
BBFILE_COLLECTIONS += "rpilinux"
BBFILE_PATTERN_rpilinux = "^${LAYERDIR}/"
BBFILE_PRIORITY_rpilinux = "6"
LAYERSERIES_COMPAT_rpilinux = "mickledore"
# We have a conf and classes directory, add to BBPATH
IMAGE_INSTALL += " qtsimplecalc"
Here is the error log:
NOTE: ###### Generate rootfs #######
NOTE: Executing '/home/pranav/Yocto/poky/build/tmp/work/raspberrypi4_64-poky-linux/rpilinux-image/1.0-r0/recipe-sysroot-native/usr /bin/createrepo_c --update -q /home/pranav/Yocto/poky/build/tmp/work/raspberrypi4_64-poky-linux/rpilinux-image/1.0-r0/oe-rootfs-re po' ...
NOTE: Running /home/pranav/Yocto/poky/build/tmp/work/raspberrypi4_64-poky-linux/rpilinux-image/1.0-r0/recipe-sysroot-native/usr/bi n/dnf -v --rpmverbosity=info -y -c /home/pranav/Yocto/poky/build/tmp/work/raspberrypi4_64-poky-linux/rpilinux-image/1.0-r0/rootfs/ etc/dnf/dnf.conf --setopt=reposdir=/home/pranav/Yocto/poky/build/tmp/work/raspberrypi4_64-poky-linux/rpilinux-image/1.0-r0/rootfs/ etc/yum.repos.d --installroot=/home/pranav/Yocto/poky/build/tmp/work/raspberrypi4_64-poky-linux/rpilinux-image/1.0-r0/rootfs --set opt=logdir=/home/pranav/Yocto/poky/build/tmp/work/raspberrypi4_64-poky-linux/rpilinux-image/1.0-r0/temp --repofrompath=oe-repo,/ho me/pranav/Yocto/poky/build/tmp/work/raspberrypi4_64-poky-linux/rpilinux-image/1.0-r0/oe-rootfs-repo makecache --refresh
DEBUG: DNF version: 4.14.0
cachedir: /home/pranav/Yocto/poky/build/tmp/work/raspberrypi4_64-poky-linux/rpilinux-image/1.0-r0/rootfs/var/cache/dnf
Added oe-repo repo from /home/pranav/Yocto/poky/build/tmp/work/raspberrypi4_64-poky-linux/rpilinux-image/1.0-r0/oe-rootfs-repo
Making cache files for all metadata files. oe-repo: has expired and will be refreshed.
repo: downloading from remote: oe-repo
oe-repo 237 MB/s | 2.3 MB 00:00
oe-repo: using metadata from Mon 05 Feb 2024 08:20:41 AM UTC.
Last metadata expiration check: 0:00:01 ago on Mon 05 Feb 2024 08:20:41 AM UTC.
User-Agent: falling back to 'libdnf': could not detect OS or basearch
Metadata cache created.
NOTE: Running /home/pranav/Yocto/poky/build/tmp/work/raspberrypi4_64-poky-linux/rpilinux-image/1.0-r0/recipe-sysroot-native/usr/bi n/dnf -v --rpmverbosity=info -y -c /home/pranav/Yocto/poky/build/tmp/work/raspberrypi4_64-poky-linux/rpilinux-image/1.0-r0/rootfs/ etc/dnf/dnf.conf --setopt=reposdir=/home/pranav/Yocto/poky/build/tmp/work/raspberrypi4_64-poky-linux/rpilinux-image/1.0-r0/rootfs/ etc/yum.repos.d --installroot=/home/pranav/Yocto/poky/build/tmp/work/raspberrypi4_64-poky-linux/rpilinux-image/1.0-r0/rootfs --set opt=logdir=/home/pranav/Yocto/poky/build/tmp/work/raspberrypi4_64-poky-linux/rpilinux-image/1.0-r0/temp --repofrompath=oe-repo,/ho me/pranav/Yocto/poky/build/tmp/work/raspberrypi4_64-poky-linux/rpilinux-image/1.0-r0/oe-rootfs-repo --nogpgcheck install alsa-lib alsa-tools alsa-utils bcm2835-dev dbus dhcpcd gstreamer1.0 gstreamer1.0-meta-base gstreamer1.0-plugins-bad gstreamer1.0-plugins-ba se gstreamer1.0-plugins-good gstreamer1.0-python gstreamer1.0-rtsp-server gstreamer1.0-vaapi hostapd i2c-tools iptables iw libstdc ++ linux-firmware-rpidistro-bcm43430 linux-firmware-rpidistro-bcm43456 module-init-tools mtd-utils openssh openssh-sftp-server ope nssl psplash-raspberrypi pulseaudio python3 python3-numpy python3-smbus qt3d qt3d-dev qt3d-mkspecs qtbase qtbase-dev qtbase-mkspec s qtbase-plugins qtbase-tools qtcharts qtcharts-dev qtcharts-mkspecs qtconnectivity-dev qtconnectivity-mkspecs qtdeclarative qtdec larative-dev qtdeclarative-mkspecs qtgraphicaleffects qtgraphicaleffects-dev qtquickcontrols2 qtquickcontrols2-dev qtquickcontrols 2-mkspecs qtsimplecalc run-postinsts wpa-supplicant locale-base-c locale-base-en-us locale-base-en-gb ERROR: Could not invoke dnf. Command '/home/pranav/Yocto/poky/build/tmp/work/raspberrypi4_64-poky-linux/rpilinux-image/1.0-r0/reci pe-sysroot-native/usr/bin/dnf -v --rpmverbosity=info -y -c /home/pranav/Yocto/poky/build/tmp/work/raspberrypi4_64-poky-linux/rpili nux-image/1.0-r0/rootfs/etc/dnf/dnf.conf --setopt=reposdir=/home/pranav/Yocto/poky/build/tmp/work/raspberrypi4_64-poky-linux/rpili nux-image/1.0-r0/rootfs/etc/yum.repos.d --installroot=/home/pranav/Yocto/poky/build/tmp/work/raspberrypi4_64-poky-linux/rpilinux-i mage/1.0-r0/rootfs --setopt=logdir=/home/pranav/Yocto/poky/build/tmp/work/raspberrypi4_64-poky-linux/rpilinux-image/1.0-r0/temp -- repofrompath=oe-repo,/home/pranav/Yocto/poky/build/tmp/work/raspberrypi4_64-poky-linux/rpilinux-image/1.0-r0/oe-rootfs-repo --nogp gcheck install alsa-lib alsa-tools alsa-utils bcm2835-dev dbus dhcpcd gstreamer1.0 gstreamer1.0-meta-base gstreamer1.0-plugins-bad gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-python gstreamer1.0-rtsp-server gstreamer1.0-vaapi hostapd i2c-t ools iptables iw libstdc++ linux-firmware-rpidistro-bcm43430 linux-firmware-rpidistro-bcm43456 module-init-tools mtd-utils openssh openssh-sftp-server openssl psplash-raspberrypi pulseaudio python3 python3-numpy python3-smbus qt3d qt3d-dev qt3d-mkspecs qtbase qtbase-dev qtbase-mkspecs qtbase-plugins qtbase-tools qtcharts qtcharts-dev qtcharts-mkspecs qtconnectivity-dev qtconnectivity-mks pecs qtdeclarative qtdeclarative-dev qtdeclarative-mkspecs qtgraphicaleffects qtgraphicaleffects-dev qtquickcontrols2 qtquickcontr ols2-dev qtquickcontrols2-mkspecs qtsimplecalc run-postinsts wpa-supplicant locale-base-c locale-base-en-us locale-base-en-gb' ret urned 1:
DNF version: 4.14.0
cachedir: /home/pranav/Yocto/poky/build/tmp/work/raspberrypi4_64-poky-linux/rpilinux-image/1.0-r0/rootfs/var/cache/dnf
Added oe-repo repo from /home/pranav/Yocto/poky/build/tmp/work/raspberrypi4_64-poky-linux/rpilinux-image/1.0-r0/oe-rootfs-repo
User-Agent: falling back to 'libdnf': could not detect OS or basearch
repo: using cache for: oe-repo oe-repo: using metadata from Mon 05 Feb 2024 08:20:41 AM UTC.
Last metadata expiration check: 0:00:01 ago on Mon 05 Feb 2024 08:20:41 AM UTC.
No match for argument: qtsimplecalc
Error: Unable to find a match: qtsimplecalc
DEBUG: Python function do_rootfs finished
This error is usually due to an empty package, which means that there is something wrong with your do_install
that is not installing something in the ${D}
folder which is ${WORKDIR}/image
The issue is that you are inherit
ing qmake5
after you defining your own do_install
and qmake5
has its own do_install
that will run the install
target on the generated Makefile
out of your simpleCalculator.pro
file:
####### Install
install: FORCE
uninstall: FORCE
FORCE:
The simple solution to this is to move inherit qmake5
before your do_install
.
Also, here is the version of the recipe that uses the git URL instead of local files:
SUMMARY = "Qt Simple Calculator Application Recipe"
DESCRIPTION = "This recipe builds a Qt project for a simple calculator application."
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
DEPENDS += "qtbase"
SRC_URI = "git://github.com/vpapadopou/qt-simple-calculator.git;protocol=https;branch=master"
SRCREV = "1af09d43f9a41ad3136a4fac9db63b9542692f91"
S = "${WORKDIR}/git"
inherit qmake5
do_install() {
install -d ${D}/opt/qtsimplecalc/
install -m 0755 simpleCalculator ${D}/opt/qtsimplecalc/
}
FILES:${PN} += "/opt/qtsimplecalc/simpleCalculator"
You can check the do_install
script run.do_install
under ${WORKDIR}/temp
.
To make the install process handled by qmake
, you can add the following to simpleCalculator.pro
file:
target.path += /opt/qtsimplecalc/
INSTALLS += target
and then remove your custom do_install
task in the recipe.
This will activate the original do_install
of the qmake5
class that will trigger make install
target which will have the following content:
####### Install
install_target: first FORCE
@test -d $(INSTALL_ROOT)/opt/qtsimplecalc/ || mkdir -p $(INSTALL_ROOT)/opt/qtsimplecalc/
$(QINSTALL_PROGRAM) $(QMAKE_TARGET) $(INSTALL_ROOT)/opt/qtsimplecalc/$(QMAKE_TARGET)
-$(STRIP) $(INSTALL_ROOT)/opt/qtsimplecalc/$(QMAKE_TARGET)
uninstall_target: FORCE
-$(DEL_FILE) $(INSTALL_ROOT)/opt/qtsimplecalc/$(QMAKE_TARGET)
-$(DEL_DIR) $(INSTALL_ROOT)/opt/qtsimplecalc/
install: install_target FORCE
uninstall: uninstall_target FORCE
FORCE: