【问题标题】:Build errors with custom recipe使用自定义配方构建错误
【发布时间】:2020-10-31 09:48:28
【问题描述】:

由于我是 yocto 的新手,我一直在尝试用简单的 C 程序制作配方,该程序使用 makefile 生成二​​进制文件。创建配方后,我收到以下错误

Command '['aarch64-poky-linux-objcopy', '--only-keep-debug', '/home/bhargav/RPI3/Build/poky/build/tmp/work/aarch64-poky-linux/myshell/0.1-r0/package/usr/bin/hello_shell', '/home/bhargav/RPI3/Build/poky/build/tmp/work/aarch64-poky-linux/myshell/0.1-r0/package/usr/bin/.debug/hello_shell']' returned non-zero exit status 1.
Subprocess output:aarch64-poky-linux-objcopy: Unable to recognise the format of the input file `/home/bhargav/RPI3/Build/poky/build/tmp/work/aarch64-poky-linux/myshell/0.1-r0/package/usr/bin/hello_shell'

ERROR: Logfile of failure stored in: /home/bhargav/RPI3/Build/poky/build/tmp/work/aarch64-poky-linux/myshell/0.1-r0/temp/log.do_package.15925
ERROR: Task (/home/bhargav/RPI3/Build/meta-shell/recipes-myshell/myshell/myshell_0.1.bb:do_package) failed with exit code '1'

这是我的食谱

SUMMARY = "bitbake-layers recipe"
DESCRIPTION = "Recipe created by bitbake-layers"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=6e0eb429dbab531d0874038360a879b9"

SRCREV = "ce92f43aea4f5ea32858892f446084ea9f2b2a7f"
SRC_URI = "git://github.com/bhargavthriler/simple_shell.git"

S = "${WORKDIR}/git"

FILES_${PN} += "${libdir}/"  

do_compile() {
    make
}

TARGET_CC_ARCH += "${LDFLAGS}"

do_install() {
    install -d ${D}${bindir}
    install -m 0755 hello_shell ${D}${bindir}
}

这是我的makefile

SRCS = $(wildcard *.c)

CC = gcc

OBJ_NAME = hello_shell

all : ${SRCS}
    $(CC) $(SRCS) -o $(OBJ_NAME)

clean :
    rm $(OBJ_NAME)

我面临构建错误。我正在使用 meta-raspberrypi 构建它 我的完整构建

bhargav@bhargav-Lenovo-Legion-Y540-15IRH-PG0:~/RPI3/Build/poky/build (master)$ bitbake rpi-basic-image
Loading cache: 100% |########################################################################################################################################################################| Time: 0:00:00
Loaded 2876 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION           = "1.46.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "aarch64-poky-linux"
MACHINE              = "raspberrypi3-64"
DISTRO               = "poky"
DISTRO_VERSION       = "3.1"
TUNE_FEATURES        = "aarch64 cortexa53 crc"
TARGET_FPU           = ""
meta                 
meta-poky            
meta-yocto-bsp       = "master:2e11d97b6c95e89aa1f9d3603a966c94c442469e"
meta-raspberrypi     = "master:27d0016b6b7634ea2abf26a06b1ab8071fbdb0d5"
meta-oe              = "master:679bb4912613f3860e8527557602251e5e5f2c41"
meta-python2         = "master:2684086f91e7074324081196c8a5f9945d39650e"
meta-shell           = "master:81fd3448f603a56409389247443439cad4fdaa67"

Initialising tasks: 100% |###################################################################################################################################################################| Time: 0:00:02
Sstate summary: Wanted 111 Found 111 Missed 0 Current 1304 (100% match, 100% complete)
NOTE: Executing Tasks
NOTE: Tasks Summary: Attempted 3725 tasks of which 3725 didn't need to be rerun and all succeeded.
bhargav@bhargav-Lenovo-Legion-Y540-15IRH-PG0:~/RPI3/Build/poky/build (master)$ bitbake myshell
Loading cache: 100% |########################################################################################################################################################################| Time: 0:00:00
Loaded 2876 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION           = "1.46.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "aarch64-poky-linux"
MACHINE              = "raspberrypi3-64"
DISTRO               = "poky"
DISTRO_VERSION       = "3.1"
TUNE_FEATURES        = "aarch64 cortexa53 crc"
TARGET_FPU           = ""
meta                 
meta-poky            
meta-yocto-bsp       = "master:2e11d97b6c95e89aa1f9d3603a966c94c442469e"
meta-raspberrypi     = "master:27d0016b6b7634ea2abf26a06b1ab8071fbdb0d5"
meta-oe              = "master:679bb4912613f3860e8527557602251e5e5f2c41"
meta-python2         = "master:2684086f91e7074324081196c8a5f9945d39650e"
meta-shell           = "master:81fd3448f603a56409389247443439cad4fdaa67"

Initialising tasks: 100% |###################################################################################################################################################################| Time: 0:00:00
Sstate summary: Wanted 12 Found 8 Missed 4 Current 123 (66% match, 97% complete)
NOTE: Executing Tasks
ERROR: myshell-0.1-r0 do_package: Fatal errors occurred in subprocesses:
Command '['aarch64-poky-linux-objcopy', '--only-keep-debug', '/home/bhargav/RPI3/Build/poky/build/tmp/work/aarch64-poky-linux/myshell/0.1-r0/package/usr/bin/hello_shell', '/home/bhargav/RPI3/Build/poky/build/tmp/work/aarch64-poky-linux/myshell/0.1-r0/package/usr/bin/.debug/hello_shell']' returned non-zero exit status 1.
Subprocess output:aarch64-poky-linux-objcopy: Unable to recognise the format of the input file `/home/bhargav/RPI3/Build/poky/build/tmp/work/aarch64-poky-linux/myshell/0.1-r0/package/usr/bin/hello_shell'

ERROR: Logfile of failure stored in: /home/bhargav/RPI3/Build/poky/build/tmp/work/aarch64-poky-linux/myshell/0.1-r0/temp/log.do_package.15925
ERROR: Task (/home/bhargav/RPI3/Build/meta-shell/recipes-myshell/myshell/myshell_0.1.bb:do_package) failed with exit code '1'
NOTE: Tasks Summary: Attempted 538 tasks of which 537 didn't need to be rerun and 1 failed.

Summary: 1 task failed:
  /home/bhargav/RPI3/Build/meta-shell/recipes-myshell/myshell/myshell_0.1.bb:do_package
Summary: There was 1 ERROR message shown, returning a non-zero exit code.
bhargav@bhargav-Lenovo-Legion-Y540-15IRH-PG0:~/RPI3/Build/poky/build (master)$

我做错了什么?

【问题讨论】:

  • 解决了吗?
  • 我还没查。忙于其他工作。会检查并通知您。

标签: linux cross-compiling yocto bitbake meta-raspberrypi


【解决方案1】:

发生错误是因为您在 makefile 中有 CC = gcc,它指向 host 中的编译器。这会覆盖 yocto 设置的 CROSS_COMPILER。所以您构建的二进制文件hello_shell 用于主机(ELF 64 位 LSB 可执行文件,x86-64),使用aarch64-poky-linux-objcopy 时会引发错误

尝试从 makefile 中删除 CC = gcc

【讨论】:

  • 我在 makefile 中注释了 CC = gcc 行,但仍然出现错误。
  • 再强调一点,如果您在编译时不打算明确执行任何操作,您可以inherit autotools 并删除 do_compile。你得到同样的错误吗?即使在干净的构建之后?
  • 在删除 do_compile 并使用 inherit autotools 之后,我现在遇到了另一个错误。我认为这与 makefile 有关。请在此处检查错误:pastebin.com/hk3DG90q
  • 错误提示在构建目录中找不到“makefile”。检查 recipes workdir 并确保 makefile 可用。您报告的问题是由于 makefile 中的“CC=GCC”,删除它应该可以解决您的 do_package 问题
  • 我没有更改SRCREV,所以我收到了错误一些更多的观察autotools无法找到makefile,删除它后构建成功,所以什么时候用任何编译编译文件/make 命令?这是配方的sn-p pastebin.com/tr3Er5Bp
猜你喜欢
  • 1970-01-01
  • 2020-02-03
  • 1970-01-01
  • 1970-01-01
  • 2020-02-25
  • 2014-02-14
  • 1970-01-01
  • 2011-11-27
  • 1970-01-01
相关资源
最近更新 更多