Updated instructions for building current versions:
1. Build and install binutils as described above.
2. Download and extract the GCC source archive.
3. Enter the GCC source folder and execute the following command (requires wget):
Code:
$ ./contrib/download_prerequisites
4. Download and extract the Newlib source archive.
5. Copy (or link) the "newlib" and "libgloss" folders from the Newlib source tree into the GCC source folder.
6. Create a build folder.
7. Enter the build folder and execute the following command:
Code:
$ $PATH_TO_GCC_SOURCES/configure --prefix=$INSTALLDIR --target=$TARGET --enable-languages="c,c++" 2>&1 | tee configure-log
8. Build the whole shebang:
Code:
$ make all 2>&1 | tee make-all-log
If you have a fast multicore machine, you can build in parallel. If you run into problems, try reducing the number of parallel processes (-jN):
Code:
$ nice -n 20 make -j all 2>&1 | tee make-all-log
9. If all goes well, install your brand-spanking new compiler:
Code:
$ make install 2>&1 | tee make-install-log
Doing a single stage build can save a lot of time, and building the dependent libraries in-tree avoids breaking your existing compiler if eg. a later GCC updates the version requirements.