Change the current directory to the ~/cygwin/src/ directory:
user@crosshost ~ $ cd ~/cygwin/src |
Extract the GCC archive, then extract the upstream GCC source archive and apply the patches it contains :
user@crosshost ~/cygwin/src $ tar jxf gcc4-4.5.0-1-src.tar.bz2
user@crosshost ~/cygwin/src $ tar jxf gcc-4.5.0.tar.bz2
user@crosshost ~/cygwin/src $ (patching and autoreconf commands omitted)
|
Where the patches touch the configuration mechanism, you need to regenerate the files generated by autotools. autoreconf doesn't work, I don't know why, so you need to invoke the correct autotools in the correct directories. The cygport file provides an example of how to do this.
GCC is picky about the exact versions of the autotools in use, so you need to make the versions it requires available.
For bonus points, use cygport prep to extract the source and apply the patches.
Create a ~/cygwin/build/gcc-4.5.0-1/ directory and change the current directory to that directory:
user@crosshost ~/cygwin/src $ mkdir ~/cygwin/build/gcc-4.5.0 user@crosshost ~/cygwin/src $ cd ~/cygwin/build/gcc-4.5.0 |
It's highly recommended that GCC be built into a separate directory from the sources which does not reside within the source tree. Building GCC in the source directory is generally untested, and building into a subdirectory of the source directory is unsupported.
Configure GCC:
user@crosshost ~/cygwin/build/gcc-4.5.0 $ ../../src/gcc-4.5.0/configure --prefix=/home/user/cygwin --target=i686-pc-cygwin \ --disable-bootstrap --enable-version-specific-runtime-libs --enable-static --enable-shared --enable-shared-libgcc \ --disable-__cxa_atexit --disable-sjlj-exceptions --enable-languages=c,c++ --disable-symvers --enable-threads=posix \ 2>&1 | tee configure.log |
Use the same configure options as used in the cygport file or reported by gcc -v
Build GCC:
user@crosshost ~/cygwin/build/gcc-4.5.0-1 $ make all 2>&1 | tee all.log |
Install GCC:
user@crosshost ~/cygwin/build/gcc-4.5.0-1 $ make install 2>&1 | install.log |
Building binutils and GCC is now complete. Test your cross-compiler by checking that a 'hello world' program can be successfully compiled on your build host and run on your Cygwin target host.