Yocto 构建:“无法找到匹配项”

问题描述 投票:0回答:1

我正在尝试构建自定义 QT 应用程序。但是,在构建

bitbake
时,
rootfs
无法找到该应用程序。

我尝试了很多事情:

  1. 已添加
    ALLOW_EMPTY_${PN}
  2. 已添加
    FILES_${PN}
  3. 从应用程序名称中删除了
    _
    -
  4. 添加
    IMAGE_INSTALL += qtsimplecalc
    。如果我删除它,它会构建,但应用程序会从
    rootfs
    中丢失。
  5. 甚至 github 存储库。没有被克隆,所以我手动克隆它。

这里是

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 

我的目录结构如下:

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 目录包含来自 github 的源代码:

https://github.com/vpapadopou/qt-simple-calculator

conf/layer.conf
文件:

  # 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" 

这是错误日志:

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
qt yocto bitbake yocto-recipe
1个回答
0
投票

此错误通常是由于空包造成的,这意味着您的

do_install
有问题,没有在
${D}
文件夹中安装某些内容,即
${WORKDIR}/image

问题是,在定义自己的

inherit
后,您正在
qmake5
ing
do_install
并且
qmake5
有自己的
do_install
,它将在您的
 中生成的 
install
 上运行 
Makefile
 目标simpleCalculator.pro
文件:

####### Install

install:  FORCE

uninstall:  FORCE

FORCE:

解决此问题的简单方法是将

inherit qmake5
移到
do_install
之前。

另外,这里是使用 git URL 而不是本地文件的配方版本:

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"

您可以检查

do_install
下的
run.do_install
脚本
${WORKDIR}/temp

要使安装过程由

qmake
处理,您可以将以下内容添加到
simpleCalculator.pro
文件中:

target.path += /opt/qtsimplecalc/
INSTALLS += target

然后删除配方中的自定义

do_install
任务。

这将激活

do_install
类的原始
qmake5
,该类将触发
make install
目标,该目标将具有以下内容:

####### 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:
© www.soinside.com 2019 - 2024. All rights reserved.