This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GCC 4.0.2 Canadian Cross Compile


Hi,

I have been having problems building GCC 4.0.2 using a GCC 4.0.2 cross
compiler.

The issue appears to be that the 'is_cross_compiler' macro in the
configure scripts does not check to see if 'build' = 'host'. It only
check to see if 'target' = 'host'.

In a Canadian Cross Compile, 'target' == 'host' != 'build' and the
compiler that is created may not run on the computer building the
compiler.

If I use 'configure --host=sparc-linux --target=sparc-linux
--build=i686-pc-linux-gnu ...' then the compiler/tools and additional
libraries need to be built using a previously made sparc-linux cross
compiler. The existing libraries used by the sparc-linux cross compiler do
not actually need to be re-built if the sparc-linux cross compiler was
compiled from the same source.

The procedure I end up with is:
-----------------------------------------------------------------------
# Set up paths etc for the build
# <target> header files/libraries are in ${CROSS_DIR}/sparc-linux/sys-root/...
PATH=${BUILD_TMP_DIR}/bin:${CROSS_DIR}/bin:${PATH}
LD_LIBRARY_PATH=${BUILD_TMP_DIR}/lib:${CROSS_DIR}/lib:${LD_LIBRARY_PATH}
export PATH LD_LIBRARY_PATH

# Create Build compiler (required as ADA Cross Compile fails
#                        if made with gcc-3.4.2)
# Code runs on <build> and compiles for <build> (i686-pc-linux-gnu)
cd gcc-local
../gcc-4.0.2/configure --prefix=${BUILD_TMP_DIR} \
    --enable-languages='c,ada' ...
make bootstrap
make install
cd ..

# Generate Cross Binary Utilities
# Code runs on <build> and creates binaries for <target> (sparc-linux)
cd binutils-cross
../binutils-2.16.1/configure --target=sparc-linux --prefix=${CROSS_DIR} \
   ...
make all
make install
cd ..

{additional steps to build C library}

# Generate Cross Compiler
# Code runs on <build> and compiles for <target> (sparc-linux)
cd gcc-cross
../gcc-4.0.2/configure --target=sparc-linux --prefix=${CROSS_DIR} \
   --enable-languages='c,c++,ada' ...
make all
make install
cd ..

# Generate Canadian Cross Binary Utilities
# Code runs on <target> and creates binaries for <target> (sparc-linux)
cd can-binutils-cross
../binutils-2.16.1/configure --host=sparc-linux --target=sparc-linux \
   --prefix=${CAN_CROSS_DIR} ...
make all
make install
cd ..

# Generate Canadian Cross Compiler
# Code runs on <target> and compiles for <target> (sparc-linux)
cd can-cross-gcc
configure --host=sparc-linux --target=sparc-linux --prefix=${CROSS_DIR} \
   --enable-languages='c,c++,ada' ...
make all
 { Curently fails here as it has set the LD_LIBRARY_PATH incorrectly for
   generating code to run on <build> to create the documentation }
make install
cd ..

---------------------------------------------------------------------

Fixing the 'is_cross_compiler' macro to check 'host' != 'build' fixes
things untill the compiler attempts to build ADA library. At this point it
fails again as the ADA library make system tries to use xgcc. If it is a
canadian cross compile, it needs to use the cross compiler, not the
canadian cross compiler.

I will submit a patch if I get the canadian cross compile to work
properly. I have not achived this since gcc-2.8.1/gnat-3.14p.

I hope this is of use for future revisions of the compiler/configure
scripts.

Regards
	Mark Fortescue.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]