yocto-第49篇-编译问题汇总及解决方案

Yocto开发篇 专栏收录该内容
73 篇文章 385 订阅 ¥39.90 ¥99.00

By: fu linux
E-mail: fulinux@sina.com
Blog: https://blog.csdn.net/fulinus
喜欢的盆友欢迎点赞和订阅!
你的喜欢就是我写作的动力!

问题1:locale-base-en-us

问题现象:

或者问题是:No package locale-base-en-us available.
编译bitbake core-image-sato 时出现:

build]$ bitbake core-image-sato 
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
ERROR: core-image-sato-1.0-r0 do_rootfs: Unable to install packages. Command '/home/peeta/poky-arm/build/tmp-glibc/work/XXXX-oe-linux-gnueabi/core-image-sato/1.0-r0/recipe-sysroot-native/usr/bin/opkg --volatile-cache -f /home/peeta/poky-arm/build/tmp-glibc/work/XXXX-oe-linux-gnueabi/core-image-sato/1.0-r0/opkg.conf -t /home/peeta/poky-arm/build/tmp-glibc/work/XXXX-oe-linux-gnueabi/core-image-sato/1.0-r0/temp/ipktemp/ -o /home/peeta/poky-arm/build/tmp-glibc/work/XXXX-oe-linux-gnueabi/core-image-sato/1.0-r0/rootfs  --force_postinstall --prefer-arch-to-version   install locale-base-en-us locale-base-en-gb' returned 255:
Collected errors:
 * opkg_prepare_url_for_install: Couldn't find anything to satisfy 'locale-base-en-us'.
 * rm_r: Failed to open dir /home/peeta/poky-arm/build/tmp-glibc/work/XXXX-oe-linux-gnueabi/core-image-sato/1.0-r0/temp/ipktemp//opkg-uOMyYC: No such file or directory.

ERROR: core-image-sato-1.0-r0 do_rootfs: Function failed: do_rootfs
ERROR: Logfile of failure stored in: /home/peeta/poky-arm/build/tmp-glibc/work/XXXX-oe-linux-gnueabi/core-image-sato/1.0-r0/temp/log.do_rootfs.2575
ERROR: Task (/home/peeta/poky-arm/meta/recipes-sato/images/core-image-sato.bb:do_rootfs) failed with exit code '1'
NOTE: Tasks Summary: Attempted 4724 tasks of which 4723 didn't need to be rerun and 1 failed.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

分析过程:

在meta/conf/distro/include/default-distrovars.inc 搜索到这个:

IMAGE_LINGUAS ?= "en-us en-gb"
  • 1

解决方案:

在build/conf/local.conf或者machine/xxx.conf文件中添加如下内容:

IMAGE_LINGUAS = ""
  • 1

问题2:Layer meta-mylayer is not compatible

问题现象

更新yocto-3.2.2版本后,以前创建的layer就出现了如下问题:

build]$ bitbake-layers create-layer ../meta-mybsp
NOTE: Starting bitbake server...
NOTE: No reply from server in 30s
ERROR: Layer meta-mylayer is not compatible with the core layer which only supports these series: gatesgarth (layer is compatible with dunfell)
ERROR: Layer meta-mylayer is not compatible with the core layer which only supports these series: gatesgarth (layer is compatible with dunfell)
ERROR: Exception in server main event loop running command [] ()
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

问题分析

初步考虑就是meta-mylayer/conf/layer.conf内容和现版本不兼容

解决方案

参考meta-yocto-bsp/conf/layer.conf
修改meta-mylayer/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 += "meta-mylayer"
BBFILE_PATTERN_meta-mylayer = "^${LAYERDIR}/"
BBFILE_PRIORITY_meta-mylayer = "5" #这里

LAYERDEPENDS_meta-mylayer = "core"
LAYERSERIES_COMPAT_meta-mylayer = "gatesgarth" #还有这里
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

问题3:Error: .err encountered

该问题参考https://fulinux.blog.csdn.net/article/details/114746070文档

问题4:Error: The OE SDK/ADT was detected

问题现象:

poky]$ source oe-init-build-env 
Error: The OE SDK/ADT was detected as already being present in this shell environment. Please use a clean shell when sourcing this environment script.
  • 1
  • 2

问题分析:

出现这个问题的原因是由于我们之前在当前的linux shell环境下使能了一些环境,使得当前的shell环境中OE SDK/ADT已经存在了。

解决方案:

更换一个shell终端或者退出当前shell,重新登录。

问题5:Error: Unable to find a match

问题现象:

使用devtool build-image命令来构建image,并将workspace中的recipes包含到的qemux86-64文件系统中。使用devtool build-image命令时,必须提供image的名称。还记得qemux86-64的编译时候的镜像名吗?参考如下:

build]$ devtool build-image core-image-sato
NOTE: Starting bitbake server...
NOTE: Reconnecting to bitbake server...
NOTE: Retrying server connection (#1)...
Parsing recipes: 100% |###################################################################################| Time: 0:00:18
Parsing of 782 .bb files complete (0 cached, 782 parsed). 1323 targets, 46 skipped, 0 masked, 0 errors.
INFO: Building image core-image-sato with the following additional packages: helloyocto learnyocto example
Loading cache: 100% |#####################################################################################| Time: 0:00:00
Loaded 1320 entries from dependency cache.
Parsing recipes: 100% |###################################################################################| Time: 0:00:00
Parsing of 782 .bb files complete (778 cached, 4 parsed). 1323 targets, 46 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION           = "1.46.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "x86_64-poky-linux"
MACHINE              = "qemux86-64"
DISTRO               = "poky"
DISTRO_VERSION       = "3.1.2"
TUNE_FEATURES        = "m64 core2"
TARGET_FPU           = ""
meta                 
meta-poky            
meta-yocto-bsp       = "my-yocto-3.1.2:569b1f5d67c57de957e243997c53ec2f81dc8dfe"
meta-altera          = "master:aa24dfcb39fce3619a87ee6eef6e4296e66d2099"
meta-mylayer         
workspace            = "my-yocto-3.1.2:569b1f5d67c57de957e243997c53ec2f81dc8dfe"

Initialising tasks: 100% |################################################################################| Time: 0:00:08
Sstate summary: Wanted 4 Found 1 Missed 3 Current 2768 (25% match, 99% complete)
NOTE: Executing Tasks
ERROR: core-image-sato-1.0-r0 do_rootfs: Could not invoke dnf. Command '/home/peeta/poky/build/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/recipe-sysroot-native/usr/bin/dnf -v --rpmverbosity=info -y -c /home/peeta/poky/build/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/rootfs/etc/dnf/dnf.conf --setopt=reposdir=/home/peeta/poky/build/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/rootfs/etc/yum.repos.d --installroot=/home/peeta/poky/build/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/rootfs --setopt=logdir=/home/peeta/poky/build/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/temp --repofrompath=oe-repo,/home/peeta/poky/build/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/oe-rootfs-repo --nogpgcheck install locale-base-en-us locale-base-en-gb rpm learnyocto helloyocto dnf packagegroup-core-x11-base packagegroup-core-ssh-dropbear packagegroup-base-extended packagegroup-core-x11-sato example packagegroup-core-boot psplash run-postinsts' returned 1:
DNF version: 4.2.2
cachedir: /home/peeta/poky/build/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/rootfs/var/cache/dnf
Added oe-repo repo from /home/peeta/poky/build/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/oe-rootfs-repo
repo: using cache for: oe-repo
not found other for: 
not found modules for: 
not found deltainfo for: 
not found updateinfo for: 
oe-repo: using metadata from Thu 22 Oct 2020 12:25:50 PM UTC.
No module defaults found
No match for argument: example
Error: Unable to find a match

ERROR: Logfile of failure stored in: /home/peeta/poky/build/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/temp/log.do_rootfs.15636
ERROR: Task (/home/peeta/poky/meta/recipes-sato/images/core-image-sato.bb:do_rootfs) failed with exit code '1'
NOTE: Tasks Summary: Attempted 6854 tasks of which 6852 didn't need to be rerun and 1 failed.

Summary: 1 task failed:
  /home/peeta/poky/meta/recipes-sato/images/core-image-sato.bb:do_rootfs
Summary: There was 1 ERROR message shown, returning a non-zero exit code.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54

问题分析:

上面的错误提示关键点在这里:

No match for argument: example
Error: Unable to find a match
  • 1
  • 2

这个example的recipe是在创建meta-mylayer自动创建的:

poky]$ cat meta-mylayer/recipes-example/example/example_0.1.bb 
SUMMARY = "bitbake-layers recipe"
DESCRIPTION = "Recipe created by bitbake-layers"
LICENSE = "MIT"

python do_build() {
    bb.plain("***********************************************");
    bb.plain("*                                             *");
    bb.plain("*  Example recipe created by bitbake-layers   *");
    bb.plain("*                                             *");
    bb.plain("***********************************************");
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

是一个没有实际内容的bb文件,只是演示了打印信息。可能由于误操作将其devtool add或者devtool modify了这个example了,于是导致编译出现了这个问题。
由于example是一个空项目,没有任何的install操作,在oe-workdir目录中也没有image目录:

poky]$ ls build/workspace/sources/example/
oe-logs  oe-workdir
poky]$ ls build/workspace/sources/example/oe-workdir
deploy-rpms               source-date-epoch                        sstate-install-package_write_rpm  temp
deploy-source-date-epoch  sstate-install-deploy_source_date_epoch  sstate-install-populate_lic
license-destdir           sstate-install-packagedata               sstate-install-populate_sysroot
pkgdata-pdata-input       sstate-install-package_qa                sysroot-destdir
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

所以就在构建文件系统时,准备安装example,但是没有任何内容。

解决方案:

解决方法有三个:

  1. 删除build/workspace/recipes或者build/workspace/appends/中所有关于example的bb文件;
  2. devtool reset example命令自动删除方法一种的文件;
  3. 在build/conf/local.conf文件中添加下面这一行:
IMAGE_INSTALL_append = " example" #这个是我复现问题时候加上的,没有可以不用管
IMAGE_INSTALL_remove = " example" #加上这个,就是说不安装example的意思
  • 1
  • 2

再次编译就不会有此类问题了:

poky]$ source oe-init-build-env 
build]$ devtool build-image core-image-sato
  • 1
  • 2

问题6:syntax error GLIB

问题现象:

configure: line 12765: syntax error near unexpected token `GLIB,'
configure: line 12765: ` PKG_CHECK_MODULES(GLIB, $GLIB_DEPS, have_glib=true, :)'
  • 1
  • 2

问题分析:

如果出现该问题需要继承pkgconfig

解决方案:

在对应的bb文件中添加:

inherit autotools pkgconfig
  • 1

问题7:

问题现象:

ERROR: Found duplicated BBFILE_COLLECTIONS 'xxx', check bblayers.conf or layer.conf to fix it.
  • 1

问题分析:

说明在有些meta layer目录中的bblayers.conf or layer.conf文件中出现了重复的:

BBFILE_COLLECTIONS +='xxx'
  • 1

一般BBFILE_COLLECTIONS表示这个meta layer的别名,
解决方法
我们可以使用自己meta layer的名字

解决方案:

#在meta-abcd/conf/layer.conf
BBFILE_COLLECTIONS +='abcd'
BBFILE_PRIORITY_abcd =  "12"
BBFILE_PATTERN_abcd := "^${LAYERDIR}/"
  • 1
  • 2
  • 3
  • 4

给我点个赞加个关注呗!万分感谢!
在这里插入图片描述