DEV Community

Avelyn Hyunjeong Choi
Avelyn Hyunjeong Choi

Posted on • Updated on

Project Stage 1

Procedure
1.Obtain the source code for the current development version of GCC from the Git repository.
git clone git://gcc.gnu.org/git/gcc.git
cd gcc

2.Build the source code to produce a working compiler on each of two environments.

  • To build GCC outside of the source tree to keep things clean, build directory was created as following.

mkdir build

Image description

cd build

3.Configure the build for each of two environments. It sets up the build to create a compiler.

x86_64 system
../configure --target=x86_64-linux-gnu --enable-languages=c,c++

AArch64 system
../configure --target=aarch64-linux-gnu --enable-languages=c,c++

4.Build GCC.
Run make to start the compilation process.

The time taken to perform the build
It took about 2 hours for build to happen.

Impact of -jN options to perform the build
The -jN option in the make command allows make to execute up to N jobs in parallel.
For example, if I run: make -j4, this allows make to run up to 4 jobs simultaneously, resulting in a much faster build process.
I used this command for AArch64 architecture, and it was a lot faster.

Image description

How I have proven that I have a working compiler

  • Checked gcc version: gcc --version
  • Create a new test program named hello.c as following.
#include <stdio.h>

int main() {
    printf("Hello, World!\n");
    return 0;
}
Enter fullscreen mode Exit fullscreen mode
  • Compile the program: gcc -o hello hello.c
  • Run the program: ./hello run the program in portugal

run the program in israel

--> This verifies that I have successfully built and installed a working compiler.

Top comments (0)