RE-POST March: SPO600 Week 7

This post would be about building GCC.

Instructions to Build GCC

  1. git clone git://gcc.gnu.org/git/gcc.git
  2. Create an empty build directory beside the source tree
  3. Go into the build directory as a non-root user.
  4. Run the configure script in the source directory using relative path ../gcc/configure
  5. Add a --prefix=dir option to specify where the software will be installed, plus any other configuration options. The dir should be within the home directory, for example, $HOME/gcc-test-001/
  6. Run the make -jn option to specify the maximum number of parallel jobs that should be executed at one time, where n is between (#of cores + 1) and (2 * #of cores + 1).
  7. Run make install as a non-root user. This should install a subdirectory of prefix directory prefix/bin, prefix/lib64
  8. Add the bin directory to PATH: PATH="prefix/bin:$PATH"

There are 2 ways to build another copy of the same GCC:

  1. Repeat the steps starting at step 2, creating a new build directory or
  2. make clean and repeat steps 4 by running the configure script
Connect to the servers, then create a src directory that will have the GCC compiler:
    
mkdir src
cd src
git clone git://gcc.gnu.org/git/gcc.git

    
mkdir build
cd build
../gcc/configure --prefix=$HOME/gcc-test-001/

Now, in my build directory, I have these files:
In gcc/Makefile.in: less Makefile.in
The @....@ are templates and it indicates that the system needs to run a test to find out what value it should insert there.

Then if we look at the Makefile in build folder: less Makefile
Before doing step 6, run the make clean command. Then just for fun, I will also be running the time command to know how long this program would build:
time make -jn

In AArch64, I used -j30, while in x86 I used -j12.

It took a total of 1 hour and 33 minutes to complete building the GCC in AArch64.

It took a total of 1 hour and 30 minutes to complete building the GCC in x86.

Then I did make install, which resulted in:

Following by: PATH="$HOME/gcc-test-001/bin:$PATH"

To get a tree view: tree ~/gcc-test-001 | less

To check the available disk use: df -h.
For the second build, I decided to use make clean.

Comments

Popular posts from this blog