[yocto] How do I enabled Fortran support in Sumo?

Mike Worster mike.worster at gmail.com
Thu Nov 15 13:31:32 PST 2018


I'm trying to get Fortran support (gfortran and libgfortran) enabled in a
Yocto Sumo build.

Based on advice I got from this site:
https://jumpnowtek.com/yocto/Add-Fortran-support-to-a-Yocto-build.html

I have enabled fortran in my local.conf via adding:

    FORTRAN_forcevariable = ",fortran"

And I have created a gcc-runtime_7.3.bbappend file containing:

    RUNTIMETARGET += "libgfortran"

And I have added gfortran to my image:

    FORTRAN_TOOLS = " \
        gfortran \
        gfortran-symlinks \
        libgfortran \
        libgfortran-dev \
     "

    IMAGE_INSTALL += " \
        ${FORTRAN_TOOLS} \
     "
After all these modifications when I go to build I see the following error:

|
../../../../../../../../work-shared/gcc-7.3.0-r0/gcc-7.3.0/libgfortran/runtime/backtrace.c:36:10:
fatal error: backtrace-supported.h: No such file or directory
|  #include "backtrace-supported.h"
|           ^~~~~~~~~~~~~~~~~~~~~~~
| compilation terminated.
| Makefile:2310: recipe for target 'backtrace.lo' failed
| make[1]: *** [backtrace.lo] Error 1

I've found I can get past this by updating
poky/meta/recipes-devtools/gcc/gcc-7.3.inc with the following line:

    CFLAGS += " -I../../libbacktrace "

The build then dies later here:

| libtool: link: cannot find the library `../libbacktrace/libbacktrace.la'
or unhandled argument `../libbacktrace/libbacktrace.la'
| Makefile:1364: recipe for target 'libgfortran.la' failed
| make[1]: *** [libgfortran.la] Error 1

I can resolve that by adjusting the Makefile found at:
tmp/work/cortexa9hf-neon-poky-linux-gnueabi/gcc-runtime/7.3.0-r0/gcc-7.3.0/build.arm-poky-linux-gnueabi.arm-poky-linux-gnueabi/arm-poky-linux-gnueabi/libgfortran/Makefile.
The following adjustment:

     $(LTLDFLAGS) $(LIBQUADLIB) ../../libbacktrace/libbacktrace.la \

gets past the failure to find the library (one directory up). Then running
the build again, there is the real problem:

| ../../libbacktrace/.libs/libbacktrace.a: member
../../libbacktrace/.libs/libbacktrace.a(atomic.o) in archive is not an
object
| collect2: error: ld returned 1 exit status
| ERROR: oe_runmake failed
| Makefile:1364: recipe for target 'libgfortran.la' failed
| make[1]: *** [libgfortran.la] Error 1

As far as I can tell, the archive's elements (atomic.o being first) are
being built for x86 instead of ARM, and thus they are not being recognized
as objects.

Does anyone have input on this issue? Any ideas why this is broken, or how
to resolve this?

-Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20181115/84535fb7/attachment.html>


More information about the yocto mailing list