Fix for libtool-cross do_qa_configure error when building gfortran

Submitted by Larry Baker on Aug. 28, 2013, 4:45 a.m. | Patch ID: 56791


Message ID
State New
Headers show

Commit Message

Larry Baker Aug. 28, 2013, 4:45 a.m.
I enabled the build of gfortran in the gcc-cross recipe using a gcc-cross_4.7.bbappend:

> # Build a gfortran cross-compiler
> FORTRAN = ",fortran"

The bitbake build fails in the libtool-cross do_qa_configure step.  See, for example, the report at

> configure: WARNING: unrecognized options: --disable-silent-rules, --with-
> sysroot 
> DEBUG: Shell function do_configure finished 
> DEBUG: Executing python function do_qa_configure 
> NOTE: Checking autotools environment for common misconfiguration 
> ERROR: This autoconf log indicates errors, it looked at host include and/or 
> library paths while determining system capabilities. 
> Rerun configure task after fixing this. The path was 
> '/home/appusr/poky/build/tmp/work/armv7a-vfp-neon-poky-linux-
> gnueabi/libtool-cross-2.4.2-r5.1/libtool-2.4.2' 
> DEBUG: Python function do_qa_configure finished 
> ERROR: Function failed: do_qa_configure

This is due to the incomplete support for gfortran in the bitbake recipes.  It looks like they were written for F77=g77 and have not been updated to support FC=gfortran.  The FC variable is not defined properly for cross-compiling: it is missing the --with-sysroot= option.  The result is a misconfiguration reported by --enable-poison-system-directories and discovered by insane.bbclass in do_qa_configure.

The patches below define the FC variables and update the default FORTRAN from f77 to fortran.  I use the DENX Yocto/ELDK-5.4 git (, so the meta layer name and the line numbers may not be an exact match to the files in the OE git repository.  Also, I am sorry I cannot use diff --git on my CentOS development system.

Unfortunately, while these patches enable the creation of a gfortran cross compiler, gfortran cross compiles fail due to a missing libgfortran.spec file.  In fact, there are no libgfortran files at all.  I don't know why.  When I built my own gfortran cross compiler previously from the latest GCC 4.7 Code Sourcery sources, it made all the necessary pieces. I did not have to build any other tools, such as libtool or libgfortran.  Maybe there are more bitbake files that have to be updated to build a functioning gfortran cross compiler.  I'll keep working on that.

Larry Baker
US Geological Survey

Patch hide | download patch | download mbox

--- original/eldk/meta/classes/native.bbclass
+++ patched/eldk/meta/classes/native.bbclass
@@ -61,2 +61,3 @@ 
+export FC = "${CCACHE}${HOST_PREFIX}gfortran ${HOST_CC_ARCH}"
export F77 = "${CCACHE}${HOST_PREFIX}g77 ${HOST_CC_ARCH}"
--- original/eldk/meta/conf/bitbake.conf
+++ patched/eldk/meta/conf/bitbake.conf
@@ -448,2 +448,3 @@ 
@@ -463,2 +464,3 @@ 
+export BUILD_FC = "${CCACHE}${BUILD_PREFIX}gfortran ${BUILD_CC_ARCH}"
--- original/eldk/meta/recipes-devtools/gcc/
+++ patched/eldk/meta/recipes-devtools/gcc/
@@ -13,3 +13,3 @@ 
# gcc 3.x expects 'f77', 4.0 expects 'f95', 4.1 and 4.2 expect 'fortran'
-FORTRAN ?= ",f77"
+FORTRAN ?= ",fortran"