无法执行二进制文件:自定义 Yocto 图层的执行格式错误



我想为phyBOARD Mira板的CANBOAT存储库创建一个Yoto层,该层将连接到船上的NMEA2000。我想读取不同的PGN值并将其存储在数据库中。

配置

我有一个 Linux 虚拟机 (Ubuntu 16.04 LTS)

Linux ubuntu 4.13.0-39-generic #44~16.04.1-Ubuntu SMP Thu Apr 5 16:43:10 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

我将所有meta图层都放在一个名为sources的文件夹中$YOCTO_DIR.在sources中,我创建了具有以下结构的meta-canboat层:

├── conf
│   └── layer.conf
├── COPYING.MIT
├── README
└── recipes-canboat
└── canboat
└── canboat.bb

canboat.bb基于Makefile的Yocto-Mega-Manual

SUMMARY = "CANBOAT"
SECTION = "base"
LICENSE = "GPLv3"
#DEPENDS = "xsltproc"
LIC_FILES_CHKSUM = "file://GPL;md5=05507c6da2404b0e88fe5a152fd12540"
S = "${WORKDIR}/git"
SRC_URI = "git://github.com/canboat/canboat.git;branch=${SRCBRANCH}"
SRCBRANCH = "master"
SRCREV = "93b2ebfb334d7a9750b6947d3a4af9b091be2432"
do_compile() {// this is not necessary for Yocto
make
}
do_install() { // for Makefile Packages do_install is necessary
oe_runmake install DESTDIR=${D}
}

构建和错误

在我执行的build目录中

bitbake canboat

并获取错误日志:

| DEBUG: Executing shell function do_compile
| mkdir -p rel/linux-x86_64
| for dir in actisense-serial analyzer n2kd nmea0183 ip group-function candump2analyzer socketcan-writer; do make -C $dir; done
| make[1]: Entering directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/actisense-serial'
| arm-phytec-linux-gnueabi-gcc  -march=armv7-a -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3   -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0=/usr/src/debug/canboat/1.0-r0 -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3=  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o ../rel/linux-x86_64/actisense-serial -I../common actisense-serial.c ../common/common.c
| make[1]: Leaving directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/actisense-serial'
| make[1]: Entering directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/analyzer'
| arm-phytec-linux-gnueabi-gcc  -march=armv7-a -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3   -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0=/usr/src/debug/canboat/1.0-r0 -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3=  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o ../rel/linux-x86_64/analyzer -I../common pgn.c analyzer.c ../common/common.c
| make[1]: Leaving directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/analyzer'
| make[1]: Entering directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/n2kd'
| arm-phytec-linux-gnueabi-gcc  -march=armv7-a -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3   -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0=/usr/src/debug/canboat/1.0-r0 -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3=  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o ../rel/linux-x86_64/n2kd -I../common main.c gps_ais.c nmea0183.c ../common/common.c -lm
| cp n2kd_monitor ../rel/linux-x86_64/n2kd_monitor
| make[1]: Leaving directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/n2kd'
| make[1]: Entering directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/nmea0183'
| arm-phytec-linux-gnueabi-gcc  -march=armv7-a -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3   -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0=/usr/src/debug/canboat/1.0-r0 -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3=  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o ../rel/linux-x86_64/nmea0183-serial  -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0=/usr/src/debug/canboat/1.0-r0 -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3=  -I../common nmeareader.c ../common/common.c
| make[1]: Leaving directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/nmea0183'
| make[1]: Entering directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/ip'
| arm-phytec-linux-gnueabi-gcc  -march=armv7-a -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3   -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0=/usr/src/debug/canboat/1.0-r0 -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3=  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o ../rel/linux-x86_64/iptee  -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0=/usr/src/debug/canboat/1.0-r0 -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3=  -I../common iptee.c ../common/common.c
| make[1]: Leaving directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/ip'
| make[1]: Entering directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/group-function'
| arm-phytec-linux-gnueabi-gcc  -march=armv7-a -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3   -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0=/usr/src/debug/canboat/1.0-r0 -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3=  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o ../rel/linux-x86_64/command-group-function -I../common command.c ../common/common.c
| arm-phytec-linux-gnueabi-gcc  -march=armv7-a -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3   -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0=/usr/src/debug/canboat/1.0-r0 -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3=  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o ../rel/linux-x86_64/request-group-function -I../common request.c ../common/common.c
| make[1]: Leaving directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/group-function'
| make[1]: Entering directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/candump2analyzer'
| arm-phytec-linux-gnueabi-gcc  -march=armv7-a -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3   -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0=/usr/src/debug/canboat/1.0-r0 -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3=  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o ../rel/linux-x86_64/candump2analyzer -I../common candump2analyzer.c ../common/common.c -lm
| make[1]: Leaving directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/candump2analyzer'
| make[1]: Entering directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/socketcan-writer'
| arm-phytec-linux-gnueabi-gcc  -march=armv7-a -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3   -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0=/usr/src/debug/canboat/1.0-r0 -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/sysroots/phyboard-mira-imx6-3=  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o ../rel/linux-x86_64/socketcan-writer -I../analyzer -I../common socketcan-writer.c ../analyzer/pgn.c ../common/common.c
| make[1]: Leaving directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/socketcan-writer'
| make -C analyzer json
| make[1]: Entering directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/analyzer'
| ../rel/linux-x86_64/analyzer -explain-xml >pgns.xml && xsltproc pgns2json.xslt pgns.xml >pgns.json

|/bin/sh: ../rel/linux-x86_64/analyzer:无法执行二进制文件:执行格式错误

| Makefile:33: recipe for target 'json' failed
| make[1]: *** [json] Error 126
| make[1]: Leaving directory '/opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/git/analyzer'
| Makefile:29: recipe for target 'all' failed
| make: *** [all] Error 2
| WARNING: /opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/temp/run.do_compile.47581:1 exit 2 from 'make'
| ERROR: Function failed: do_compile (log file is located at /opt/PHYTEC_BSPs/yocto_fsl/build/tmp/work/cortexa9hf-neon-phytec-linux-gnueabi/canboat/1.0-r0/temp/log.do_compile.47581)

我知道gnueabi平台上的-x86_64二进制文件可能不兼容。如何编译此存储库以克服这种不兼容性?

GitHub 存储库

元灿船

答案取决于二进制文件的作用:二进制文件的结果是否取决于运行该工具的体系结构?如果您为问题添加详细信息,有人可能会提供更详细的答案。

选项 1:如果工具结果独立于架构,那么您可以首先编译 canboat 的"本机"(即构建主机架构)版本,然后确保目标构建依赖于本机构建并使用本机构建中的工具。这将意味着配方中的小变化和制作文件中的一些变化

选项 2:如果结果确实取决于 arch,则可能必须使用 qemu 来运行该工具。

在poky来源中都有这两种情况的例子。

可能还有第三种选择:如果构建成功不需要这些文件,则可以在首次启动/安装时在安装后脚本中运行该工具(并修改构建系统以在构建期间不执行此操作)。

最新更新