Patchwork Fix for libtool-cross do_qa_configure error when building gfortran

login
register
mail settings
Submitter Larry Baker
Date Aug. 31, 2013, 6:57 a.m.
Message ID <B4688002-BE89-4F32-9BD5-3D0B4DF9321F@usgs.gov>
Download mbox | patch
Permalink /patch/57157/
State New
Headers show

Comments

Larry Baker - Aug. 31, 2013, 6:57 a.m.
Here are the complete patches required to obtain a functional gfortran cross compiler.  I have also submitted a bug report to Yocto bugzilla (https://bugzilla.yoctoproject.org/show_bug.cgi?id=5091) and uploaded my patch file there.

There are still four warning messages from the build:

WARNING: QA Issue: gcc-runtime: Files/directories were installed but not shipped
  /usr/lib/gcc/arm-linux-gnueabi/4.7.2/libgfortranbegin.la
  /usr/lib/gcc/arm-linux-gnueabi/4.7.2/libcaf_single.la
  /usr/lib/gcc/arm-linux-gnueabi/4.7.2/libcaf_single.a
  /usr/lib/gcc/arm-linux-gnueabi/4.7.2/libgfortranbegin.a

I do not understand enough about bitbake or the gcc-cross and gcc-runtime recipes to know exactly where to find the source of these errors.  And, I was unsuccessful in properly specifying the DEPENDS and PROVIDES relationships in my bbappend files (see my Yocto bugzilla post), so I left those out.

I have yet to actually run the code -- I have not yet prepared the proper rootfs image for my target.

Larry Baker
US Geological Survey
650-329-5608
baker@usgs.gov

>>>>> snip <<<<<
>>>>> snip <<<<<


On Aug 27, 2013, at 9:45 PM, Larry Baker wrote:

> 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
> 
> 
> --- 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}"
>

Patch

--- original/openembedded-core/meta/classes/native.bbclass
+++ patched/openembedded-core/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/openembedded-core/meta/conf/bitbake.conf
+++ patched/openembedded-core/meta/conf/bitbake.conf
@@ -447,2 +447,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/openembedded-core/meta/recipes-devtools/gcc/gcc-configure-common.inc
+++ patched/openembedded-core/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}"
--- original/openembedded-core/meta/recipes-devtools/gcc/gcc-runtime.inc
+++ patched/openembedded-core/meta/recipes-devtools/gcc/gcc-runtime.inc
@@ -78,2 +78,3 @@ 
   libgfortran-dev \
+  libgfortran-staticdev \
   libmudflap \
@@ -121,5 +122,11 @@ 
 FILES_libgfortran-dev = " \
-  ${libdir}/libgfortran.a \
+  ${libdir}/libgfortran.spec \
   ${libdir}/libgfortran.so \
-  ${libdir}/libgfortranbegin.a"
+  ${libdir}/libgfortran.la \
+  ${libdir}/libgfortranbegin.la \
+  ${libdir}/libcaf_single.la"
+FILES_libgfortran-staticdev = " \
+  ${libdir}/libgfortran.a \
+  ${libdir}/libgfortranbegin.a \
+  ${libdir}/libcaf_single.a"