在 Yocto styhead 上构建配方失败,因为 Bitbake 不移动源文件

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

我的配方构建失败,我不知道为什么。这是我输入的命令:

bitbake example1

然后我得到了这些错误日志:

Loading cache: 100% |#################################################################| Time: 0:00:00
Loaded 245 entries from dependency cache.
Parsing recipes: 100% |################################################################################################| Time: 0:01:11
Parsing of 920 .bb files complete (123 cached, 797 parsed). 1875 targets, 70 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION           = "2.9.1"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "arm-poky-linux-gnueabi"
MACHINE              = "beaglebone-yocto"
DISTRO               = "poky"
DISTRO_VERSION       = "5.1"
TUNE_FEATURES        = "arm vfp cortexa8 neon callconvention-hard"
TARGET_FPU           = "hard"
meta                 
meta-poky            
meta-yocto-bsp       
workspace            
meta-mylayer         = "master:e72d641a9988976ca9144ca3fd8f9a9988d3bdc5"

Checking sstate mirror object availability: 100% |#####################################################################| Time: 0:00:11
Sstate summary: Wanted 126 Local 0 Mirrors 116 Missed 10 Current 150 (92% match, 96% complete)
NOTE: Executing Tasks
WARNING: example1-1.0-r0 do_unpack: example1: the directory ${WORKDIR}/${BP} (/home/user/Projects/yocto/sources/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/example1/1.0/example1-1.0) pointed to by the S variable doesn't exist - please set S within the recipe to point to where the source has been unpacked to
ERROR: example1-1.0-r0 do_compile: Execution of '/home/user/Projects/yocto/sources/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/example1/1.0/temp/run.do_compile.2977111' failed with exit code 1
ERROR: Logfile of failure stored in: /home/user/Projects/yocto/sources/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/example1/1.0/temp/log.do_compile.2977111
Log data follows:
| DEBUG: Executing shell function do_compile
| cc1: fatal error: /home/user/Projects/yocto/sources/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/example1/1.0/example1.c: No such file or directory
| compilation terminated.
| WARNING: exit code 1 from a shell command.
ERROR: Task (/home/user/Projects/yocto/poky/meta-mylayer/recipes-example/example/example1.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 833 tasks of which 823 didn't need to be rerun and 1 failed.

Summary: 1 task failed:
  /home/user/Projects/yocto/poky/meta-mylayer/recipes-example/example/example1.bb:do_compile
    log: /home/user/Projects/yocto/sources/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/example1/1.0/temp/log.do_compile.2977111
Summary: There was 1 WARNING message.
Summary: There was 1 ERROR message, returning a non-zero exit code.

这是我的食谱:

meta-mylayer/recipes-example/example/example1.bb

LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

SRC_URI = "file://example1.c"

do_compile() {
  ${CC} ${FLAGS} ${LDFLAGS} ${WORKDIR}/example1.c -o example1
}

do_install() {
  install -d ${D}/${bindir}
  install -m 0755 ${S}/example1 ${D}/${bindir}
}

meta-mylayer/recipes-example/example/files/example1.c

#include <stdio.h>

int main() {
  printf("Hello world");

  return 0;
}

看来问题只是

bitbake
找不到
example1.c
,但我认为
 meta-mylayer/recipes-example/example/files
是放置它的正确位置。所以我真的不明白出了什么问题。

我多次阅读了开发任务手册中的3理解和创建层章节,尤其是3.1创建您自己的层部分,但我没有找到解决方案。

我找到的解决方法

偶然我成功地通过在

example1.bb
中添加此任务来构建配方,但我想这不是解决问题的正确方法

do_unpack() {
  cp /home/user/Projects/yocto/poky/meta-mylayer/recipes-example/example/files/example1.c /home/user/Projects/yocto/sources/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/example1/1.0
}

编辑:我重新尝试编译配方,因为我正在进行特定的提交。所以我检查了当前的 styhead 稳定版本 (e72d641a9988976ca9144ca3fd8f9a9988d3bdc5),现在我收到一个警告:

WARNING: example1-1.0-r0 do_unpack: example1: the directory ${WORKDIR}/${BP} (/home/user/Projects/yocto/sources/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/example1/1.0/example1-1.0) pointed to by the S variable doesn't exist - please set S within the recipe to point to where the source has been unpacked to
yocto bitbake yocto-recipe
1个回答
0
投票

我遇到了这个:https://docs.yoctoproject.org/next/migration-guides/migration-5.1.html#general-notes

“do_unpack 中的文件现在解压到

WORKDIR/sources-unpack/
WORKDIR/.

这就是为什么 bitbake 找不到

example1.c
。自
WORKDIR/sources-unpack
发布以来,源文件现已移至
styhead

显然,Yocto 开发人员现在建议在食谱中编写以下内容:

S = "${WORKDIR}/sources"
UNPACKDIR = "${S}"

这可以防止源文件被移动到

WORKDIR/sources-unpack
,而是直接将它们放在
WORKDIR/sources
中。结果,
WORKDIR/sources-unpack
目录就变得不必要了。

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.