Yocto:使用 Bitbake 构建图像时出错

Posted

技术标签:

【中文标题】Yocto:使用 Bitbake 构建图像时出错【英文标题】:Yocto: Error in building an image using Bitbake 【发布时间】:2021-11-18 18:20:12 【问题描述】:

我正在尝试按照Yocto 中所述的映像构建说明进行操作。我做了完全相同的事情,另外我为图像构建释放了多达 150GB 的存储空间。但是,当我运行 bitbake imx-image-core 时,出现以下错误:

Initialising tasks: 100% |##################################################| Time: 0:00:03
Sstate summary: Wanted 2482 Found 0 Missed 2482 Current 82 (0% match, 3% complete)
NOTE: Executing Tasks
NOTE: Setscene tasks completed
WARNING: bjam-native-1.71.0-r0 do_fetch: Failed to fetch URL https://dl.bintray.com/boostorg/release/1.71.0/source/boost_1_71_0.tar.bz2, attempting MIRRORS if available
WARNING: cwautomacros-native-20110201-r0 do_fetch: Failed to fetch URL https://downloads.sourceforge.net/cwautomacros.berlios/cwautomacros-20110201.tar.bz2, attempting MIRRORS if available
WARNING: socat-1.7.3.3-r0 do_fetch: Failed to fetch URL http://www.dest-unreach.org/socat/download/socat-1.7.3.3.tar.bz2, attempting MIRRORS if available
WARNING: linux-imx-headers-5.4-r0 do_fetch: Failed to fetch URL git://source.codeaurora.org/external/imx/linux-imx.git;protocol=https;branch=imx_5.4.70_2.3.0, attempting MIRRORS if available
WARNING: llvm-project-source-9.0.1-9.0.1-r0 do_fetch: Failed to fetch URL git://github.com/llvm/llvm-project;protocol=https;branch=release/9.x, attempting MIRRORS if available
ERROR: llvm-project-source-9.0.1-9.0.1-r0 do_fetch: Fetcher failure: Fetch command export PSEUDO_DISABLED=1; unset _PYTHON_SYSCONFIGDATA_NAME; export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus"; export SSH_AGENT_PID="1974"; export SSH_AUTH_SOCK="/run/user/1000/keyring/ssh"; export PATH="/home/sami/edm_yocto/sources/poky/scripts:/home/sami/edm_yocto/build-xwayland/tmp/work-shared/llvm-project-source-9.0.1-r0/recipe-sysroot-native/usr/bin/aarch64-poky-linux:/home/sami/edm_yocto/build-xwayland/tmp/work-shared/llvm-project-source-9.0.1-r0/recipe-sysroot/usr/bin/crossscripts:/home/sami/edm_yocto/build-xwayland/tmp/work-shared/llvm-project-source-9.0.1-r0/recipe-sysroot-native/usr/sbin:/home/sami/edm_yocto/build-xwayland/tmp/work-shared/llvm-project-source-9.0.1-r0/recipe-sysroot-native/usr/bin:/home/sami/edm_yocto/build-xwayland/tmp/work-shared/llvm-project-source-9.0.1-r0/recipe-sysroot-native/sbin:/home/sami/edm_yocto/build-xwayland/tmp/work-shared/llvm-project-source-9.0.1-r0/recipe-sysroot-native/bin:/home/sami/edm_yocto/sources/poky/bitbake/bin:/home/sami/edm_yocto/build-xwayland/tmp/hosttools"; export HOME="/home/sami"; LANG=C git -c core.fsyncobjectfiles=0 clone --bare --mirror https://github.com/llvm/llvm-project /home/sami/edm_yocto/downloads//git2/github.com.llvm.llvm-project --progress failed with exit code 128, output:
Cloning into bare repository '/home/sami/edm_yocto/downloads//git2/github.com.llvm.llvm-project'...
remote: Enumerating objects: 5546825, done.        
remote: Counting objects: 100% (2383/2383), done.        
remote: Compressing objects: 100% (1430/1430), done.        
error: RPC failed; curl 56 GnuTLS recv error (-54): Error in the pull function.
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

ERROR: llvm-project-source-9.0.1-9.0.1-r0 do_fetch: Fetcher failure for URL: 'git://github.com/llvm/llvm-project;protocol=https;branch=release/9.x'. Unable to fetch URL from any source.
ERROR: Logfile of failure stored in: /home/sami/edm_yocto/build-xwayland/tmp/work-shared/llvm-project-source-9.0.1-r0/temp/log.do_fetch.22673
ERROR: Task (/home/sami/edm_yocto/sources/meta-clang/recipes-devtools/clang/llvm-project-source.bb:do_fetch) failed with exit code '1'
ERROR: linux-imx-headers-5.4-r0 do_fetch: Fetcher failure: Fetch command export PSEUDO_DISABLED=1; unset _PYTHON_SYSCONFIGDATA_NAME; export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus"; export SSH_AGENT_PID="1974"; export SSH_AUTH_SOCK="/run/user/1000/keyring/ssh"; export PATH="/home/sami/edm_yocto/sources/poky/scripts:/home/sami/edm_yocto/build-xwayland/tmp/work/aarch64-mx8mm-poky-linux/linux-imx-headers/5.4-r0/recipe-sysroot-native/usr/bin/aarch64-poky-linux:/home/sami/edm_yocto/build-xwayland/tmp/work/aarch64-mx8mm-poky-linux/linux-imx-headers/5.4-r0/recipe-sysroot/usr/bin/crossscripts:/home/sami/edm_yocto/build-xwayland/tmp/work/aarch64-mx8mm-poky-linux/linux-imx-headers/5.4-r0/recipe-sysroot-native/usr/sbin:/home/sami/edm_yocto/build-xwayland/tmp/work/aarch64-mx8mm-poky-linux/linux-imx-headers/5.4-r0/recipe-sysroot-native/usr/bin:/home/sami/edm_yocto/build-xwayland/tmp/work/aarch64-mx8mm-poky-linux/linux-imx-headers/5.4-r0/recipe-sysroot-native/sbin:/home/sami/edm_yocto/build-xwayland/tmp/work/aarch64-mx8mm-poky-linux/linux-imx-headers/5.4-r0/recipe-sysroot-native/bin:/home/sami/edm_yocto/sources/poky/bitbake/bin:/home/sami/edm_yocto/build-xwayland/tmp/hosttools"; export HOME="/home/sami"; LANG=C git -c core.fsyncobjectfiles=0 clone --bare --mirror https://source.codeaurora.org/external/imx/linux-imx.git /home/sami/edm_yocto/downloads//git2/source.codeaurora.org.external.imx.linux-imx.git --progress failed with exit code 128, output:
Cloning into bare repository '/home/sami/edm_yocto/downloads//git2/source.codeaurora.org.external.imx.linux-imx.git'...
remote: Enumerating objects: 24, done.        
remote: Counting objects: 100% (24/24), done.        
remote: Compressing objects: 100% (22/22), done.        
error: RPC failed; curl 56 GnuTLS recv error (-54): Error in the pull function.
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

ERROR: linux-imx-headers-5.4-r0 do_fetch: Fetcher failure for URL: 'git://source.codeaurora.org/external/imx/linux-imx.git;protocol=https;branch=imx_5.4.70_2.3.0'. Unable to fetch URL from any source.
ERROR: Logfile of failure stored in: /home/sami/edm_yocto/build-xwayland/tmp/work/aarch64-mx8mm-poky-linux/linux-imx-headers/5.4-r0/temp/log.do_fetch.5664
ERROR: Task (/home/sami/edm_yocto/sources/meta-imx/meta-bsp/recipes-kernel/linux/linux-imx-headers_5.4.bb:do_fetch) failed with exit code '1'
NOTE: Tasks Summary: Attempted 3098 tasks of which 945 didn't need to be rerun and 2 failed.

Summary: 2 tasks failed:
  /home/sami/edm_yocto/sources/meta-clang/recipes-devtools/clang/llvm-project-source.bb:do_fetch
  /home/sami/edm_yocto/sources/meta-imx/meta-bsp/recipes-kernel/linux/linux-imx-headers_5.4.bb:do_fetch
Summary: There were 7 WARNING messages shown.
Summary: There were 4 ERROR messages shown, returning a non-zero exit code.

我发现错误来自克隆此 repo:git://source.codeaurora.org/external/imx/linux-imx.git;protocol=https;branch=imx_5.4.70_2.3.0

当我手动克隆这个 repo 时,我工作得很好,但是当我运行 bitbake 时,它​​一次又一次地产生相同的错误。我该如何解决这个问题?这实际上是来自这个 repo 吗?

谢谢

【问题讨论】:

【参考方案1】:

构建中的问题来自 2 个 git-repositories llvm-projectlinux-imx-headers 的获取(克隆)失败。之前的答案中提出了多种解决方案:

    确保安装所需的主机包部分here中提到的所有要求都安装在您的主机中,并且您正在如上所述的Ubuntu18或Ubuntu20上运行。 (如果您在不同的版本上运行,您可能会遇到这些意想不到的问题)。

    可能是缺少 openssl 包的问题 (git error: RPC failed; curl 56 GnuTLS recv error (-54): Error in the pull function)

    sudo apt update && sudo apt install openssl curl gnutls-bin

    您可能需要升级 http post 缓冲区,检查 The remote end hung up unexpectedly while git cloning

    可能只是网络连接不好,比如repo sync stuck at 99% because of frequent internet disconnections

最后一件事,当您再次尝试构建时,首先尝试通过在 bitbake 构建命令中添加选项 -c cleansstate 来清理状态缓存,如下所示:

bitbake -c cleansstate imx-image-core

然后再次执行正常的构建命令

bitbake imx-image-core

【讨论】:

感谢您的回答。我已经尝试了提到的每一个解决方案,但我仍然遇到同样的错误,这次只有 linux-imx-headers_5.4.bb。该错误更具体到 linux-imx-headers_5.4.bb 文件。如何解决? 你能删除克隆的 git 存储库 /home/sami/edm_yocto/downloads//git2/source.codeaurora.org.external.imx.linux-imx.git,然后按照上述方法执行 cleansstate 和重试重新构建?我认为既然它是为 llvm 项目解决的,那么它也应该为 linux-imx-headers 解决。 当我尝试这样做并重新运行 bitbake 时,它​​再次安装了 linux-imx-headers,显示相同类型的错误。可以在没有 limux-imx-headers 的情况下执行 bitbake 吗? 换句话说,如果我手动安装了 linux-imx-headers。如何告诉 bitbake 这个包已经存在? @SamiArja 根据 yocto 第 345 行中的 fetch script,如果 git repo 已存在于同一路径中,则可以跳过克隆。所以需要执行如下命令:git -c core.fsyncobjectfiles=0 clone --bare --mirror https://source.codeaurora.org/external/imx/linux-imx.git /home/sami/edm_yocto/downloads//git2/source.codeaurora.org.external.imx.linux-imx.git --progress

以上是关于Yocto:使用 Bitbake 构建图像时出错的主要内容,如果未能解决你的问题,请参考以下文章

Gif 动画不适用于 Qt 5.8 中的 Yocto Pyro。如何使用 libqgif.so 在 bitbake 中构建 qtbase 5.8?

Yocto1构建嵌入式Linux系统

Yocto2构建嵌入式Linux系统

Yocto bitbake 错误:没有提供“配方名称”

yocto和bitbake

Yocto学习笔记