If you have access to a build cross-toolchain, it might be easier to use/install that one. However, you might run into problems with it - the headers might have wrong information, you can't change the linkers text location , its built for big-endian instead of little-endian. But on the other hand, most (if not all) work without problems. Here is a list of websites with cross-toolchains:
This is naturally not the only cross-tool chain build guide in the world. If you have trouble comprehending this section, you might consider visiting these great sites:
Keep in mind that most of the documentation regarding building the cross-compiler came from the HOWTO Build a Cross Toolchain in Brief.We are going to build an ARM cross tool chain (cross-platform compiler, cross-platform binutils) for a arm-coff file format (you could pick arm-elf, or arm-aout format as well). This COFF format produces flat, or standalone binaries, not tied in to any operating system.
The sources will reside in /ipaq/src, the /ipaq/build as the build directory, and /ipaq/local as the installation prefix.
Neccessary steps:
cd /ipaq/src/gcc-2.95.2 patch -p0 < ../gcc-2.95.2-diff-991022 cd gcc patch -p0 < ../../gcc-fold-const.patch
Create the build directories. These are the directories where the programs will be build. In this document, /ipaq/build is the build directory.
mkdir /ipaq/build mkdir /ipaq/build/binutils-2.9.5.0.22 mkdir /ipaq/build/gcc-2.95.2
BinUtils are your friends. They are essentialy the basic tools needed by the cross-compiler to function. They include utilties such as objcopy, objdump, as, ar, strip, ld and bunch other.
/ipaq/src/binutils-2.9.5.0.22/configure --target=arm-coff --prefix=/ipaq/local --host=i386 make make install
For the cross-compiler to compile correctly, its neccesary to have the include files from the Linux. Even though you are going to compile programs using your own include headers, this step is still neccesary. If you don't follow this step, you wont be able to compile the GNU gcc cross-compiler. There only reason why you want to this is that GCC will compile. You can remove the include files later on.
Dirty secret: It uses the include files to make its libgcc.a file. If you are going to link source files using gcc, then you need this file. If you aren't and you are going to use your own libraries, you won't use this file.
make dep
cd /ipaq/local/arm-linux
mkdir include
cd include
cp -dR /ipaq/src/kernel/linux/include/asm-arm ./
cp -dR /ipaq/src/kernel/linux/include/linux ./
cd /ipaq/src/gcc-2.95.2/gcc/config/arm
TARGET_LIBGCC2_CFLAGS = -fomit-frame-pointer -fPIC
which should result in:
TARGET_LIBGCC2_CFLAGS = -fomit-frame-pointer -fPIC -Dinhibit_libc -D__gthr_posix_h
cd /ipaq/build/gcc-2.95.2
/ipaq/src/gcc-2.95.2/configure --target=arm-coff --host=i386-pc-linux-gnu --prefix=/ipaq/local --disable-threads --with-cpu=strongarm110 -enable-languages=c
make
make install
If there are problems, such as:
GCC_CFLAGS=$(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) -I./include $(TCFLAGS)
Add to it: -Dinhibit_libc, so that it will look like:
GCC_CFLAGS=$(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) -I./include $(TCFLAGS) -Dinhibit_libc
make install
Instead of arm-coff you can use arm-aout if you want too.