SPO600 Lab4 -GCC Build Lab

 In this lab, we are practicing about building large software project, utilizing tools such as make and automake/autotools. I will work on two server, x86-001 and aarch64-002

Task  - on each of the servers, obtain build and install the source code for the current development version of the GCC compiler.

Step 1 - Obtain the source code

 step 1.1

the command to create a directory for cloning the GCC source code:

mkdir gccsource

 step 1.2

command to clone the source code into the current directory:

git clone git://gcc.gnu.org/git/gcc.git ./gccsource

Step 2 - Configure the build

step 2.1

Create a directory for the build of GCC and go into it. We use this directory to build the ggc so that the files created during the build go into this directory. Commands:

mkdir gcc-build-003

cd gcc-build-003

step 2.2

When I configure the build,  I do not want the new GCC wipe out the original gcc in the server. So, I use the --prefix=$HOME/spo600/lab4/gcc-test-003 to set the target directory of the install when i configure. Full command:

../gccsource/configure --prefix=$HOME/spo600/lab4/gcc-test-003

Step 3. Perform the build

We perform the build with the command:

 time make -j 24 |& tee build.log

time is the shell built-in command for record the time of the build

-j option is the specific the maximum number of job which make will execute simultaneously.

|& is equivalent to 2>&1 | which gather the stdout and stderr and pipe it to the tee command, while the tee command is to record the data to the named file. 

The time record for the aarch64 server:


The time record for the x86 server:



Notes: 
real is the time spend in real life.
user is the total CPU time spent in user mode 
sys is the time spend in system (kernel) mode

Step 4. Install the build

step 4.1

command to install the build: 

make install

command to check the version:

./gcc --version

gcc --version

in the aarch64 server:

gcc version we just installed:


default gcc version of the server:


in the x86 server:

gcc version we just installed in:



default gcc version of the server:



step 4.2

in the aarch64 server:

create a c file for test:



compile the file:

./gcc-test-003/bin/gcc -o jeff jeff.c

Execute the c program in aarch64 server:


Execute the c program in x86 server:



Step 5 - update the timestamp of the pass.cc

Command:
touch passes.cc


Step 6 - Rebuild the software after update the timestamp


Command:
time make


time required for aarch64 server:

time required for x86 server:



Step 7 - Null Rebuild the software (did not update any timestamp after the last build)

Command:
time make

time required for aarch64 server:


time required for x86 server:


Reflection:

In this workshop, I practiced to build a gcc into the system. I learn the way to install the gcc to a certain directory with the prefix=directory during the configure process. Also,  I practice how to use makefile and the make command, which is very important for automating the build processes. And, using the -j number option for the make command to set the maximum number of job handling in parallel can effectively shorten the time for the make instruction.. I personally studied what the three value show by the time instruction. Also, I tried the "screen -RaD" instruction. It allows user to disconnect with the previous session and reconnect to the session when needed. Lastly, I experienced the desperation that the file make failed after waiting for an hour. There was error when I perform the build on the x86 server after 1 hour wait. Repeated three times. I finally remove everything with "rm -rf" and try again.  It finally works.  


Comments

Popular posts from this blog

SPO600 Project Stage 1 (Pt.1) - Create a GCC Pass

SPO600 Project Stage 2 (Pt.1) - GCC pass locating clone function

SPO600 Project Stage 3 - Identify clones of multiple functions and compare them