Search code examples
yoctonvidia-jetson

How to specify older gcc version in yocto


I'm trying to build an image for the nvidia jetson nano board using yocto (zeus branch), here is my configuration:

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"

bu i'm getting the following error:

| /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.

it seems to me that is a version compatibility problem.

in my local.conf i have:

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"

the 7.x version is specified but yocto don't found any compatible version

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

How can i force yocto to use 7.x version, or how can i make yocto detect 7.x versions?


Solution

  • This is meta-tegra special sauce. Quote from README:

    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

    In general, it's a good practice to read through the layer README when you start using a layer.