Discussion:
[yocto] How do I enabled Fortran support in Sumo?
Mike Worster
2018-11-15 21:31:32 UTC
Permalink
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
akuster808
2018-11-15 21:42:15 UTC
Permalink
Post by Mike Worster
I'm trying to get Fortran support (gfortran and libgfortran) enabled
in a Yocto Sumo build.
https://jumpnowtek.com/yocto/Add-Fortran-support-to-a-Yocto-build.html
    FORTRAN_forcevariable = ",fortran"
    RUNTIMETARGET += "libgfortran"
I recently ran into something similar. I ended up using in my local.conf
FORTRAN_forcevariable = ",fortran"
RUNTIMETARGET_append_pn-gcc-runtime = " libquadmath" <<<--- maybe key??

and in one recipe I had a depends on "libgfortran" and is seems to build
fine.

- armin
Post by Mike Worster
    FORTRAN_TOOLS = " \
        gfortran \
        gfortran-symlinks \
        libgfortran \
        libgfortran-dev \
     "
    IMAGE_INSTALL += " \
        ${FORTRAN_TOOLS} \
     "
|
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
    CFLAGS += " -I../../libbacktrace "
| libtool: link: cannot find the library
`../libbacktrace/libbacktrace.la <http://libbacktrace.la>' or
unhandled argument `../libbacktrace/libbacktrace.la
<http://libbacktrace.la>'
| Makefile:1364: recipe for target 'libgfortran.la
<http://libgfortran.la>' failed
| make[1]: *** [libgfortran.la <http://libgfortran.la>] Error 1
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.
     $(LTLDFLAGS) $(LIBQUADLIB) ../../libbacktrace/libbacktrace.la
<http://libbacktrace.la> \
gets past the failure to find the library (one directory up). Then
| ../../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
<http://libgfortran.la>' failed
| make[1]: *** [libgfortran.la <http://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
Mike Worster
2018-11-15 22:17:14 UTC
Permalink
Thanks for your input. Unfortunately adding your suggested line:
RUNTIMETARGET_append_pn-gcc-runtime = " libquadmath"
doesn't seem to change the build error for me.

Odd thing is when I look at the output of the RUNTIMETARGET variable it
doesn't appear to be set:
$ bitbake -e libgfortran | grep "RUNTIMETARGET"
# $RUNTIMETARGET
RUNTIMETARGET=""
Post by Mike Worster
I'm trying to get Fortran support (gfortran and libgfortran) enabled in a
Yocto Sumo build.
https://jumpnowtek.com/yocto/Add-Fortran-support-to-a-Yocto-build.html
FORTRAN_forcevariable = ",fortran"
RUNTIMETARGET += "libgfortran"
I recently ran into something similar. I ended up using in my local.conf
FORTRAN_forcevariable = ",fortran"
RUNTIMETARGET_append_pn-gcc-runtime = " libquadmath" <<<--- maybe key??
and in one recipe I had a depends on "libgfortran" and is seems to build
fine.
- armin
FORTRAN_TOOLS = " \
gfortran \
gfortran-symlinks \
libgfortran \
libgfortran-dev \
"
IMAGE_INSTALL += " \
${FORTRAN_TOOLS} \
"
|
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
CFLAGS += " -I../../libbacktrace "
| 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
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.
$(LTLDFLAGS) $(LIBQUADLIB) ../../libbacktrace/libbacktrace.la \
gets past the failure to find the library (one directory up). Then running
| ../../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
Loading...