Libgfortran doesn't appear to compile correctly on the latest Rocko (or on Morty, and presumably Pyro too). I can enable fortran support by adding 'FORTRAN_forcevariable = ",fortran"' to my local.conf, which (I think) should enable Fortran in gcc/libgcc, and should allow me to build the libgfortran target. I'm uncertain whether it works when compiling for on/for x86-64, but it doesn't seem to work when compiling on an x86-64 host for an ARM target. With no patches, the build errors out because it can't find compiled libraries/headers for libbacktrace. If I manually add the header paths as extra CFLAGS during libgfortran.inc's do_comfigure() step, I can get all the way to linking before the build complains about not being able to find libbacktrace.la. If I manually add the path to libgfortran's Makefile.in (similar to this patch: https://www.mail-archive.com/openembedded-core@lists.openembedded.org/msg98445.html ), I get a little farther and then eventually get a failure that resembles: libbacktrace.a(atomic.o) in archive is not an object With no Fortran support, I can't make an LAPACK recipe and thus I can't use most linear algebra libraries/tools on target.
Some extra notes. It seems that libbacktrace is always built for my host architecture (x86-64), regardless of what the target is. So on my machine, the archive: build/tmp/${MACHINE}/${DISTRO}/work/cortexa9hf-neon-ua-linux-gnueabi/gcc-runtime/7.2.0-r0/gcc-7.2.0/build.arm-ua-linux-gnueabi.arm-ua-linux-gnueabi/libbacktrace/libbacktrace.la appears to contain x86-64 .o's instead of ARM.
I've sent a patch which fixes this against master and also added a test for this to oe-selftest.
Created attachment 4162 [details] Full error log bitbake libgfortran with MACHINE="qemux86_64"
Hi there, I am stuck with the same problem. I tried the afore mentioned patch (regarding libbacktrace in Makefile.am / Makefile.in), but no luck: ERROR: libgfortran-7.2.0-r0 do_packagedata: The recipe libgfortran is trying to install files into a shared area when those files already exist. Those files and their manifest location are: /home/mschoepf/identpro/yocto/ros-devel/tmp/pkgdata/qemux86-64/runtime/libgfortran (matched in manifest-qemux86-64-gcc-runtime.packagedata) /home/mschoepf/identpro/yocto/ros-devel/tmp/pkgdata/qemux86-64/runtime/libgfortran-dev (matched in manifest-qemux86-64-gcc-runtime.packagedata) /home/mschoepf/identpro/yocto/ros-devel/tmp/pkgdata/qemux86-64/runtime/libgfortran-staticdev (matched in manifest-qemux86-64-gcc-runtime.packagedata) Please verify which recipe should provide the above files. Can you please post you patch or where to find it. I searched in poky master but could not find it there... Thanks and Regards, Matthias
Nevermind, I found it in openembedded-core master.
http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=4ac5511f940232a198ebc3e1c012c252d9ddc6fd
Thanks, Richard! You rock.
I have a similar issue in 'sumo' branch. The patch you are pointing here is not enough to solve the issue. I have to apply the following patch to be able to find libbacktrace headers: diff -Naur gcc-7.3.0/libgfortran/Makefile.in gcc-7.3.0.modif/libgfortran/Makefile.in --- gcc-7.3.0/libgfortran/Makefile.in 2018-01-25 09:17:54.059232055 +0100 +++ gcc-7.3.0.modif/libgfortran/Makefile.in 2019-01-08 12:42:00.583138367 +0100 @@ -582,7 +582,7 @@ toolexeclib_DATA = libgfortran.spec libgfortran_la_LINK = $(LINK) $(libgfortran_la_LDFLAGS) libgfortran_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` \ - $(LTLDFLAGS) $(LIBQUADLIB) ../libbacktrace/libbacktrace.la \ + $(LTLDFLAGS) $(LIBQUADLIB) ../../libbacktrace/libbacktrace.la \ $(HWCAP_LDFLAGS) \ -lm $(extra_ldflags_libgfortran) \ $(version_arg) -Wc,-shared-libgcc @@ -603,7 +603,7 @@ -I$(MULTIBUILDTOP)../libgcc \ -I$(srcdir)/$(MULTISRCTOP)../libbacktrace \ -I$(MULTIBUILDTOP)../libbacktrace \ - -I../libbacktrace + -I../../libbacktrace gfor_io_src = io/size_from_kind.c $(am__append_2) gfor_io_headers = \ but then I get the following error: | /home/sergio/YOCTO/build/tmp/work/aarch64-poky-linux/gcc-runtime/7.3.0-r0/recipe-sysroot-native/usr/bin/aarch64-poky-linux/../../libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/7.3.0/ld: ../../libbacktrace/.libs/libbacktrace.a(dwarf.o): Relocations in generic ELF (EM: 62) | /home/sergio/YOCTO/build/tmp/work/aarch64-poky-linux/gcc-runtime/7.3.0-r0/recipe-sysroot-native/usr/bin/aarch64-poky-linux/../../libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/7.3.0/ld: ../../libbacktrace/.libs/libbacktrace.a(dwarf.o): Relocations in generic ELF (EM: 62) | /home/sergio/YOCTO/build/tmp/work/aarch64-poky-linux/gcc-runtime/7.3.0-r0/recipe-sysroot-native/usr/bin/aarch64-poky-linux/../../libexec/aarch64-poky-linux/gcc/aarch64-poky-linux/7.3.0/ld: ../../libbacktrace/.libs/libbacktrace.a(dwarf.o): Relocations in generic ELF (EM: 62) | ../../libbacktrace/.libs/libbacktrace.a(dwarf.o): error adding symbols: File in wrong format | collect2: error: ld returned 1 exit status | Makefile:1364: recipe for target 'libgfortran.la' failed | make[1]: *** [libgfortran.la] Error 1 | make[1]: Leaving directory '/home/sergio/YOCTO/build/tmp/work/aarch64-poky-linux/gcc-runtime/7.3.0-r0/gcc-7.3.0/build.aarch64-poky-linux.aarch64-poky-linux/aarch64-poky-linux/libgfortran' | Makefile:1242: recipe for target 'all' failed | make: *** [all] Error 2 | ERROR: oe_runmake failed | WARNING: exit code 1 from a shell command. | ERROR: Function failed: do_compile (log file is located at /home/sergio/YOCTO/build/tmp/work/aarch64-poky-linux/gcc-runtime/7.3.0-r0/temp/log.do_compile.24547) ERROR: Task (/home/sergio/YOCTO/workspace/poky/meta/recipes-devtools/gcc/gcc-runtime_7.3.bb:do_compile) failed with exit code '1' So It seems that libbacktrace is always built for my host architecture instead of for arm64 bits... Is this a known problem? Am I doing something wrong?
The problem was using a bbappend file for recipes-devtools/gcc/gcc-runtime_7.3.bbappend with: RUNTIMETARGET += "libgfortran" It seems that in 'sumo' libgfortran is a separate recipe so avoiding this bbappend file fortran compiles properly as it is. Sorry for the noise.