fortranyoctogfortranyocto-recipeyocto-layer

How to enable Fortran support in Yocto via a .bbappend layer?


I'm new to yocto and I am working on a custom Yocto layer (meta-deimos) and I'm trying to enable fortran support in the compiler. This is because I have a python script that requires the scipy package, which requires a fortran compiler. I successfully managed to build an image with libgfortran and gfortran support, but only after manually modifying the openembedded-core recipe gcc-13.3.inc. I am not sure if this is ideal and I'd like to do this properly via a .bbappend in my own layer (if possible). This way all my customizations are in my own dedicated layer. However when I am building the image, I get this error:

Loading cache: 100% |##########################################################################################################################| Time: 0:00:00
Loaded 4745 entries from dependency cache.
Parsing recipes: 100% |########################################################################################################################| Time: 0:00:00
Parsing of 2844 .bb files complete (2831 cached, 13 parsed). 4748 targets, 516 skipped, 2 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
WARNING: preferred version riscv of openocd not available (for item openocd)
WARNING: versions of openocd available: 0.12+git
ERROR: Nothing RPROVIDES 'libgfortran' (but /home/arrr/yocto-dev/meta-hpc-bsp/recipes-core/images/pcie-demo.bb RDEPENDS on or otherwise requires it)
nativesdk-libgfortran RPROVIDES libgfortran but was skipped: libgfortran needs fortran support to be enabled in the compiler
libgfortran was skipped: libgfortran needs fortran support to be enabled in the compiler
NOTE: Runtime target 'libgfortran' is unbuildable, removing...
Missing or unbuildable dependency chain was: ['libgfortran']
ERROR: Required build target 'pcie-demo' has no buildable providers.
Missing or unbuildable dependency chain was: ['pcie-demo', 'libgfortran']

Summary: There were 2 WARNING messages.
Summary: There were 2 ERROR messages, returning a non-zero exit code.

This is the layer structure that was created and added using the bitbake commands, and I already confirmed that it is correctly added.

meta-deimos/
├── conf
│   └── layer.conf
├── COPYING.MIT
├── README.txt
├── recipes-core
│   └── images
│       └── pcie-demo.bbappend
└── recipes-devtools
    └── gcc
        └── gcc_13.3.bbappend

The contents of the files are the following:

meta-deimos/conf/layer.conf

# We have a conf and classes directory, add to BBPATH
BBPATH .= ":${LAYERDIR}"

# We have recipes-* directories, add to BBFILES
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
            ${LAYERDIR}/recipes-*/*/*.bbappend"

BBFILE_COLLECTIONS += "meta-deimos"
BBFILE_PATTERN_meta-deimos = "^${LAYERDIR}/"
BBFILE_PRIORITY_meta-deimos = "99"

LAYERDEPENDS_meta-deimos = "core"
LAYERSERIES_COMPAT_meta-deimos = "scarthgap"

meta-deimos/recipes-core/images/pcie-demo.bbappend

IMAGE_INSTALL:append = " \
    cmake \
    gfortran \
    gfortran-symlinks \
    libgfortran \
"

meta-deimos/recipes-devtools/gcc/gcc_13.3.bbappend

# Add gfortran (the GNU Fortran compiler)
FORTRAN = ",fortran"

What is the correct way to override or append FORTRAN in my .bbappend layer? How can I fix the error?

Thanks in advance.


Solution

  • Manage to make it work by adding this to build/conf/local.conf, it's a bit better as I am not touching openembedded files.

    FORTRAN:forcevariable = ",fortran"