问题
I want to create a Yocto layer for the CANBOAT Repository for phyBOARD Mira board which will be connected to a NMEA2000 on a boat. I would like to read different PGN values and store it in a database.
configuration
I have a Linux Virtual Machine (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
I have all the meta
layers in a folder called sources
in the $YOCTO_DIR
. Within the sources
I have created the meta-canboat
layer with following structure:
├── conf
│ └── layer.conf
├── COPYING.MIT
├── README
└── recipes-canboat
└── canboat
└── canboat.bb
canboat.bb is based on the Yocto-Mega-Manual for Makefile
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 and error
in the build
directory I execute
bitbake canboat
and obtain the error log:
| 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: cannot execute binary file: Exec format error
| 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)
I understand that there might be incompatibility for -x86_64
binaries on gnueabi
platforms. How can I compile this repository in order to overcome this incompatibility?
GitHub Repo
meta-canboat
回答1:
The answer depends on what the binary does: do the results of the binary depend on the architecture the tool runs on? If you add details to the question, someone might be able to provide a more detailed answer.
Option 1: If the tool results are independent of architecture, then you can first compile a "native" (i.e. build host arch) version of canboat and then make sure the target build depends on the native one and uses the tools from the native build. This will mean small changes in the recipe and some changes in the Makefiles
Option 2: If the results do depend on arch, you might have to use qemu to run the tool.
There are examples of both cases inside the poky sources.
There may be a third option: if the files are not needed for the build to succeed otherwise, you could run the tool in a postinstall script on first boot/install (and modify the build system to not do it during build).
来源:https://stackoverflow.com/questions/50177447/cannot-execute-binary-file-exec-format-error-for-a-custom-yocto-layer