I was just in the process of creating a native arm-softfloat-linux-gnu-gcc on i486-pc-linux-gnu. The crossdev toolchain was setup flawlessly, but when I attempted to cross-compile gcc, I ran into some very strange errors.

About half-way through the configure stage, configure began re-identifying the host and build systems.

The issue was that the flags --enable-serial-host --enable-serial-target --enable-serial-build were not passed when the operation was determined to be a cross-compilation.

Moreover, I noticed that the is_crosscompile() function in the same file was incorrect - can someone please verify this? I'm fairly positive from the gcc configuration script.

For a regular cross-compile, CHOST != CBUILD, and CHOST == CTARGET. However, when performing a Canadian-cross (building a compiler on CBUILD intended to run on CHOST, to compile binaries for CTARGET) both CHOST != CTARGET and CBUILD != CTARGET.

The point is though, that even for straight cross-compiles it's usually more dependent on CHOST being set to a different architecture than CTARGET.

My patch is included as an attachment, feel free to remove the is_crosscompile() section if I'm in error there, but the first section will properly cross-compile a compiler.

~/Chris
--- toolchain.eclass_old        2007-08-30 18:34:01.000000000 +0000
+++ toolchain.eclass    2007-08-30 18:35:27.000000000 +0000
@@ -54,7 +54,14 @@
        fi
 fi
 is_crosscompile() {
-       [[ ${CHOST} != ${CTARGET} ]]
+       # [[ ${CHOST} != ${CTARGET} ]]
+
+       # Note: The definition of a cross compile is when CBUILD != CHOST, 
+       # or equivalently, CBUILD != CTARGET for straight cross-compiles. 
+       # CHOST differs from CTARGET only for a Canadian Cross. -- cfriedt
+
+       [[ ${CBUILD} != ${CTARGET} ]]
+
 }
 
 tc_version_is_at_least() { version_is_at_least "$1" "${2:-${GCC_PV}}" ; }
@@ -1225,14 +1232,22 @@
                --infodir=${DATAPATH}/info \
                --with-gxx-include-dir=${STDCXX_INCDIR}"
 
+       # Note: The definition of a cross compile is when CBUILD != CHOST, 
+       # or equivalently, CBUILD != CTARGET . CHOST and CTARGET because 
+       # are only different for a Canadian Cross. -- cfriedt
+
        # All our cross-compile logic goes here !  woo !
        confgcc="${confgcc} --host=${CHOST}"
        if is_crosscompile || tc-is-cross-compiler ; then
+
                # Straight from the GCC install doc:
                # "GCC has code to correctly determine the correct value for 
target
                # for nearly all native systems. Therefore, we highly recommend 
you
                # not provide a configure target when configuring a native 
compiler."
                confgcc="${confgcc} --target=${CTARGET}"
+
+               # prevents things (like gcc) from resetting CHOST / CTARGET 
half-way during the configure / make process
+               confgcc="${confgcc} --enable-serial-host --enable-serial-target 
--enable-serial-build"
        fi
        [[ -n ${CBUILD} ]] && confgcc="${confgcc} --build=${CBUILD}"
 

Reply via email to