Patchwork Fix for libtool-cross do_qa_configure error when building gfortran

login
register
mail settings
Submitter Larry Baker
Date Aug. 28, 2013, 4:45 a.m.
Message ID <12F39B37-5963-490E-BE3F-4053AFDD76A2@usgs.gov>
Download mbox | patch
Permalink /patch/56791/
State New
Headers show

Comments

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 http://www.mail-archive.com/yocto@yoctoproject.org/msg13845.html:

> 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 (http://www.denx.de/wiki/ELDK-5/EldkBuilding), 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
650-329-5608
baker@usgs.gov

Patch

--- original/eldk/meta/classes/native.bbclass
+++ patched/eldk/meta/classes/native.bbclass
@@ -61,2 +61,3 @@ 
export CXX = "${CCACHE}${HOST_PREFIX}g++ ${HOST_CC_ARCH}"
+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 @@ 
export CXX = "${CCACHE}${HOST_PREFIX}g++ ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
+export FC = "${CCACHE}${HOST_PREFIX}gfortran ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
export F77 = "${CCACHE}${HOST_PREFIX}g77 ${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
@@ -463,2 +464,3 @@ 
export BUILD_CXX = "${CCACHE}${BUILD_PREFIX}g++ ${BUILD_CC_ARCH}"
+export BUILD_FC = "${CCACHE}${BUILD_PREFIX}gfortran ${BUILD_CC_ARCH}"
export BUILD_F77 = "${CCACHE}${BUILD_PREFIX}g77 ${BUILD_CC_ARCH}"
--- original/eldk/meta/recipes-devtools/gcc/gcc-configure-common.inc
+++ patched/eldk/meta/recipes-devtools/gcc/gcc-configure-common.inc
@@ -13,3 +13,3 @@ 
# gcc 3.x expects 'f77', 4.0 expects 'f95', 4.1 and 4.2 expect 'fortran'
-FORTRAN ?= ",f77"
+FORTRAN ?= ",fortran"
LANGUAGES ?= "c,c++${FORTRAN}${JAVA}"