如何在 yocto 中指定旧的 gcc 版本

How to specify older gcc version in yocto

我正在尝试使用 yocto(zeus 分支)为 nvidia jetson nano 板构建图像,这是我的配置:

Build Configuration:
BB_VERSION           = "1.44.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "aarch64-poky-linux"
MACHINE              = "jetson-nano"
DISTRO               = "poky"
DISTRO_VERSION       = "3.0.2"
TUNE_FEATURES        = "aarch64 armv8a crc"
TARGET_FPU           = ""
meta                 
meta-poky            
meta-yocto-bsp       = "zeus:5e1f52edb7a9f790fb6cb5d96502f3690267c1b1"
meta-python          
meta-filesystems     
meta-oe              
meta-multimedia      = "zeus:bb65c27a772723dfe2c15b5e1b27bcc1a1ed884c"
meta-tegra           = "zeus:23a9f6c12a741b4067d7a2ee601b98c766850e47"

我收到以下错误:

| /home/rui/projects/embeddeddfit/yocto/jetson-nano-build/tmp/work/armv8a_tegra210-poky-linux/cuda-samples/10.0.326-1-r0/recipe-sysroot/usr/local/cuda-10.0/include/crt/host_config.h:129:2: error: #error -- unsupported GNU version! gcc versions later than 7 are not supported!
|   129 | #error -- unsupported GNU version! gcc versions later than 7 are not supported!
|       |  ^~~~~
| Makefile:327: recipe for target 'UnifiedMemoryStreams.o' failed
| make: *** [UnifiedMemoryStreams.o] Error 1
| ERROR: oe_runmake failed
| WARNING: exit code 1 from a shell command.
| ERROR: Execution of '/home/rui/projects/embeddeddfit/yocto/jetson-nano-build/tmp/work/armv8a_tegra210-poky-linux/cuda-samples/10.0.326-1-r0/temp/run.do_compile.24230' failed with exit code 1:
| test.c:1:10: fatal error: omp.h: No such file or directory
|     1 | #include <omp.h>
|       |          ^~~~~~~
| compilation terminated.

我觉得是版本兼容性问题。

在我的 local.conf 我有:

MACHINE = "jetson-nano"

LICENSE_FLAGS_WHITELIST = "commercial"

IMAGE_CLASSES += "image_types_tegra"

IMAGE_FSTYPES = "tegraflash"

GCCVERSION = "7.%"

CUDA_VERSION="10.0"

IMAGE_INSTALL_append = " cuda-samples"

已指定 7.x 版本,但 yocto 未找到任何兼容版本

NOTE: Resolving any missing task queue dependencies
NOTE: preferred version 7.% of gcc-cross-aarch64 not available (for item virtual/aarch64-poky-linux-gcc)
NOTE: versions of gcc-cross-aarch64 available: 9.2.0

如何强制 yocto 使用 7.x 版本,或者如何让 yocto 检测 7.x 版本?

gcc 配方位于

sources/poky/meta/recipes-devtools/gcc/

如果您的版本与您想要的不同,您将不得不 download/make 另一个食谱。

这是meta-tegra特制酱汁。引自自述文件:

CUDA 10 supports up through gcc 7 only, and some NVIDIA-provided binary libraries appear to be compiled with g++ 7 and cause linker failures when building applications with g++ 6, so only gcc 7 should be used if you intend to use CUDA. See the following wiki pages for instructions on including gcc 7 in your builds:

Using gcc7 from the contrib layer

Using linaro gcc7 for CUDA support

一般来说,开始使用层时通读层 README 是个好习惯。