Monday, February 10, 2014

Getting the correct pre-requisites for building gcc


Today I had to build a gcc cross compiler for my OS related experiments (I was building the bare bone OS as described in http://wiki.osdev.org/Bare_Bones). For some reason, gcc would not build. Turned out the versions of mpc, mpfr and gmp that I downloaded were likely not compatible, and were causing problems.

After some searching on the net I found that inside gcc source tree, there is a folder called contrib which contains a script called download_prerequisites. So, all I needed to do was to get into gcc source folder and execute:

$ ./contrib/download_prerequisites.

This downloaded the correct versions of the prerequisites and I was then able to successfully build the i586-elf target gcc cross compiler.