LAB 04 - SERVER 1

"How I Built GCC From Source: A Step-by-Step Guide"

"The GNU Compiler Collection (GCC) is a powerful tool for compiling source code into executable programs. As a developer, it's essential to understand how compilers work. In this blog post, I'll walk you through my experience of building GCC from scratch, challenges I faced, and tips to optimize the process"

 x86-001

Step 1: Configure the Build Process

""""./contrib/download_prerequisites

mkdir build

cd build

../configure --enable-languages=c,c++ --disable-multilib""""

STEP 2:  Build GCC using make:

make -j$(nproc)



STEP 3: Prove that it’s different from the system compiler

Comparison of System GCC (11.3.1) vs Custom-Built GCC on x86 Server:

When comparing the system's default GCC (version 11.3.1) to the custom-built development GCC, there are several key differences worth noting.

  1. System GCC is stable and reliable, with optimizations that are tailored for broad compatibility and production use. However, it lacks the latest features and optimizations available in the development version of GCC.

  2. The development GCC I built offers more advanced features, potentially better performance, and optimizations that are tailored for newer C/C++ standards and modern hardware. However, it is still under development and might contain experimental bugs or instability, especially for legacy software.

  3. While the system GCC offers reliability, the development GCC shines in its potential for improved performance, especially when compiling newer code or leveraging the latest compiler features.


SYSTEM==>

NEW GCC==>


STEP 4: CALCULATE TIME

INITIAL BUILD

Calculation:

Start Time: ~08:49 (when the build began) End Time: 09:20 (when xgcc was created)

Duration: ~31 minutes


REBUILT





STEP 5: SUCCESSFULL C PROGRAM



STEP 6: UPDATE TIMESTAMP ON PASSES.CC



TIME:


NULL BUILD:


REFLECTION==>

This lab was a valuable hands-on experience in understanding how to build and install a compiler from source code, which is essential for many development and research tasks. Through this lab, I gained insight into the complexities involved in managing different versions of the GCC compiler and the various trade-offs between stability and cutting-edge features in software development.

1. Building from Source:
The process of building GCC from source on both the x86 and aarch64 servers was both challenging and enlightening. I followed the instructions carefully to install and build the development version of GCC. Initially, I faced a few difficulties, such as resolving dependencies and understanding the various configuration options, but with the help of resources like the GCC internals manual, I managed to complete the build
2. Build Time Insights:
I also learned about how make handles builds and rebuilds, and how the time required for a rebuild can be drastically reduced compared to the initial full build. This experience emphasized the importance of efficient build systems when working with large software projects.
3. Overall, this lab taught me the value of understanding the tools I use in development and how version control (even at the level of GCC versions) can impact the results of compiling and building software. Although the development GCC can be exciting with new features, I realize that for most of my day-to-day work, the stability of the system GCC would be my go-to choice, unless I'm working on a project that explicitly requires the newer features and optimizations offered by the development version.




Comments

Popular posts from this blog

Project Stage 1: Create a GCC pass

LAB 03

Project Stage 2: Part 2( The End)