Skip to contentSkip to conversation

libgfortran: Work around libbacktrace build failures

PATCH New Jason Wessel 1 participant 1 message Dec 9, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libgfortran: Work around libbacktrace build failures

While it is not clear how to depend on the libbacktrace in such a way that it will be in the sysroot for a build, it is possible to generate the library and header on the fly which will have the same c linkage to the shared object as the one provided internally with gcc by asking it to build at the time libgfortran is building.

The build of libgfortran fails as follows when fortran is enabled in the local.conf with:

FORTRAN_forcevariable = ",fortran"

Error text:

libtool: compile: x86_64-wrs-linux-gcc -m64 -march=core2 -mtune=core2
-msse3 -mfpmath=sse
--sysroot=/opt/build/libgfortran/7.2.0-r0/recipe-sysroot
-DHAVE_CONFIG_H
-I. -I../../../../../../../../work-shared/gcc-7.2.0-r0/gcc-7.2.0/libgfortran -iquote../../../../../../../../work-shared/gcc-7.2.0-r0/gcc-7.2.0/libgfortran/io -I../../../../../../../../work-shared/gcc-7.2.0-r0/gcc-7.2.0/libgfortran/../gcc -I../../../../../../../../work-shared/gcc-7.2.0-r0/gcc-7.2.0/libgfortran/../gcc/config -I/opt/build/libgfortran/7.2.0-r0/gcc-7.2.0/build.x86_64-wrs-linux.x86_64-wrs-linux/x86_64-wrs-linux/libgfortran/../.././gcc -I../../../../../../../../work-shared/gcc-7.2.0-r0/gcc-7.2.0/libgfortran/../libgcc -I/opt/build/libgfortran/7.2.0-r0/gcc-7.2.0/build.x86_64-wrs-linux.x86_64-wrs-linux/x86_64-wrs-linux/libgfortran/../libgcc -I../../../../../../../../work-shared/gcc-7.2.0-r0/gcc-7.2.0/libgfortran/../libbacktrace -I/opt/build/libgfortran/7.2.0-r0/gcc-7.2.0/build.x86_64-wrs-linux.x86_64-wrs-linux/x86_64-wrs-linux/libgfortran/../libbacktrace -I../libbacktrace -std=gnu11 -Wall -Wstrict-prototypes
-Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings
-Werror=implicit-function-declaration -Werror=vla -fcx-fortran-rules
-ffunction-sections -fdata-sections -std=gnu11 -O2 -pipe -g
-Wunknown-pragmas -c ../../../../../../../../work-shared/gcc-7.2.0-r0/gcc-7.2.0/libgfortran/runtime/backtrace.c
-fPIC -DPIC -o .libs/backtrace.o ../../../../../../../../work-shared/gcc-7.2.0-r0/gcc-7.2.0/libgfortran/runtime/backtrace.c:36:10:
fatal error: backtrace-supported.h: No such file or directory #include
"backtrace-supported.h"

This problem was also reported here over a year ago:
https://lists.yoctoproject.org/pipermail/yocto/2016-November/033228.html

Using this patch I was able to build fortan and use it to build a working version of Atlas on the target system.

---
 meta/recipes-devtools/gcc/libgfortran.inc | 7 +++++++
 1 file changed, 7 insertions(+)
meta/recipes-devtools/gcc/libgfortran.inc +7 -0
index 5f5d4af758..2f806e12e0 100644
@@ -15,6 +15,13 @@ do_configure () {
 	# Easiest way to stop bad RPATHs getting into the library since we have a
 	# broken libtool here
 	sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${B}/${TARGET_SYS}/libgfortran/libtool
+	# Setup libbacktrace and build it because it is needed for the compile phase
+	# This is a work around for the proper libbacktrace integration for fortran
+	mkdir -p ${B}/${TARGET_SYS}/libbacktrace
+	cd ${B}/${TARGET_SYS}/libbacktrace
+	btrelpath=${@os.path.relpath("${S}/libbacktrace", "${B}/${TARGET_SYS}/libbacktrace")}
+	$btrelpath/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
+	oe_runmake MULTIBUILDTOP=${B}/${TARGET_SYS}/libbacktrace/
 }
 EXTRACONFFUNCS += "extract_stashed_builddir"
 do_configure[depends] += "${COMPILERDEP}"
Signature · 1 line
2.11.0