Project - Stage 1

In this post, I will build GCC compiler on servers located in SPO600 server Portugal and Israel, and then verify the results.

You can see the detailed information about the SPO600 project here.


Build GCC in x86_64 System

Before getting started, execute the following command to connect to portugal.cdot.systems using SSH with the private SSH key and username. When prompted for a passphrase, enter the passphrase you set previously to establish the connection:

ssh -i private_ssh_key username@portugal.cdot.systems

If the connection is successful, you can confirm the presence of the password.txt file using the ls command. This file contains a randomly generated string password that can be used for login instead of the passphrase.


First, execute the following command to fetch the current development version of GCC from the Git repository:

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


To create an object tree outside the source tree, create a build directory outside of the gcc directory and navigate into it.

mkdir build
cd build


Run the following command to generate the Makefile by configuring the build:


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


This process may take some time.


Afterward, you can create a simple code in hello.c file and compile it using the make command, followed by running the executable with ./hello to verify that it runs successfully.






Build GCC in AArch64
 System


Using a similar approach, after connecting to israel.cdot.systems and obtaining GCC source code, follow the next steps:


1. Execute the following command to configure the build:


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


2. Verify that it's working as expected.




Building GCC was completed relatively quickly on both servers.


What is -jN options?

The -jN option is used with the make command and is used to specify the number of parallel jobs or processes that make is allowed to run simultaneously during the build process. It's often used to speed up the build process, especially on multi-core processors, by enabling parallel compilation and linking of source files.


Here's what -jN means:


- -j: This is the option flag to specify parallel jobs.


- N: This is the number of jobs or processes to run in parallel. You should replace N with the desired number of parallel jobs you want to allow. For example, -j4 means allowing make to run up to 4 jobs in parallel.


For example, if you have a project with a large codebase and want to take advantage of your multi-core CPU to speed up the compilation process, you can use the -j option like this:


make -j4


This will allow up to 4 compilation jobs to run simultaneously, which can significantly reduce the build time. The appropriate value for N depends on your system's hardware capabilities and the complexity of your project. You can experiment with different values to find the optimal number for your specific case.



Working compiler


As I used gcc compiler, I can prove it works by creating a simple code using gcc compiler.

This is the code for hello.c:    


#include <stdio.h>


int main() {

    printf("Hello, C!\n");

    return 0;

}


Below are the outputs on each server.


[mkim251@portugal x86_64]$ gcc hello.c -o hello2c

[mkim251@portugal x86_64]$ ./hello2c 

Hello, C! 


[mkim251@israel aarch64]$ gcc hello.c -o hello2c

[mkim251@israel aarch64]$ ./hello2c 

Hello, C!


Comments

Popular posts from this blog

Unveiling the World of Software Development Methodologies: Agile, Scrum, and DevOps Made Simple

Understanding Docker: A Comprehensive Guide

Lab1 - Code Review