Next Previous Contents

7. Installing the GNU CC compilers

You need to restart your system back into the normal Linux system to compile the gcc compilers. Before you reboot, unmount the partitions you mounted (that contained the glibc sources) and mount the LFS root partition read only by running mount -o remount,ro / /

7.1 Installing GCC 2.95.2

The GCC Installation notes recommend a separate directory for the object files. This means you have a directory where the gcc sources reside in and a different directory where compiled files are being created. Say you unpacked the gcc archive in /usr/src/gcc-2.95.2 , you could make a directory called /usr/src/gcc-install

// Begin test.c
#include <stdio.h>
int main() {
   printf("Hello World!\n");
   return 0;
}
// End test.c

// Begin test2.c
#include <iostream.h>
int main() {
   cout << "Hello World!" << endl;
   return 0;
}
// End test2.c

7.2 Installing GCC 2.7.2.3

Enter the right value for <cpu>. If you have a Pentium, enter i586. If you have a PII or higher, enter i686. If you don't have an Intel based platform than you have to figure out yourself what to enter since the only experience I have are with Intel based platforms (sorry, but I just don't have the money to buy myself an alpha, SPARC or whatever system ;)

make LANGUAGES=c
make stage1 (ignore errors about files not found)
make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O2"
make stage2
make CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O2"
make compare


Next Previous Contents