Install build essential tools on Ubuntu 22.04 or 20.04 LTS Linux

To compile programs from their source code, we need some tools and libraries available through a single package called on Build essential on Ubuntu 20.04 | 22.04 |18.04 or Debian 11 | 10 base repository. Here we learn how to install it.

Build essential is a name for a package that includes the GCC/g++ compilers and libraries and some other utilities required to compile software written in C and C++.

The Gnu Compiler Collection, GCC for short, is a collection of compilers and offers a uniform interface for creating programs in C, C ++, Objective-C, Fortran, Ada, Assembler and Go.

The original meaning of GCC was GNU C Compiler, but because several other languages ​​have been added since then, the meaning has changed to GNU Compiler Collection. Today the C compiler is called gcc in lower case to make it possible to distinguish it from the whole.

The key packages automatically installed on our Debian or Ubuntu system from Build-essentials are GCC– it is a GNU compile for C Programming; g++  for compiling C++ programming language; libc6-dev – GNU C library; Make – The traditional build system or a tool directs compiler how to work; to pack or unpack a Debian package, utility dpkg-dev is also there.

In short, by setting up build-essential we get all the required tools we need to compile software on Ubuntu/Debian systems.

If you have already created packages of any kind yourself, you will have already installed the build-essential package. In addition to a compiler each for C and C ++, it also contains numerous helpful tools that are so widely used by developers (e.g. Makefiles) that they can be taken for granted under any system that wants to compile something.
This article aims to help compile programs using the GCC on Ubuntu. It does not intend to provide any information programming language.

Install build-essential tools on Ubuntu 20.04 or 22.04 Linux

The commands given below will be the same for all Debian and its based systems including Linux Mint, MX Linux, POP! OS Linux and others.

1. Open a command terminal

To install the package instantly on Linux, the easiest way is to use the command terminal. To open the terminal app either use keyboard shortcut keys: Ctrl+ALT+T or go to the Application launcher and find it there.

 

2. Run system update

Before moving further and installing the developer tools for compiling source code in Ubuntu or Debian, run the system update command to rebuild the repository cache.

sudo apt update

 

3. Command to install build-essential on Ubuntu

Well, just like thousands of packages the “Build-essentials” is also available via the base repository of Debian or Ubuntu. Hence, just use the APT package manager command given below.

sudo apt install build-essential manpages-dev

Note: manpages-dev is just to provide Manual pages about using GNU/Linux for development. You can skip it if you want.

ommand to install build essential on Ubuntu

The following packages are required for languages ​​other than C and C ++ :

  • gobjc (Objective-C)
  • gfortran (Fortran)
  • gnat ( universe, Ada)

Command to install the packages:

sudo apt install gobjc gfortran gnat
sudo apt install gobjc gfortran gnat

4. Check gcc and g++ version

To know which version of GCC and G++ is on your system use the given commands:

gcc --version
g++ --version

Check GCC and G version command

 

5. How to compile source code on Debian or Ubuntu 22.04/20.4

Once you have the build-essential package installed on your system we can start compiling the source of software we want. For example, let’s you want to install the popular ImageMagick Image convertor tool on Debian Linux using its source code. The first thing we should have on your system is the “source code” that we want to compile.

Here we are cloning the source of ImageMagick from its Git repository. If you already have a source of the program you want to compile then you can go ahead.

sudo git clone https://github.com/ImageMagick/ImageMagick.git

Switch to your source code folder, here it is ImageMagick:

cd  ImageMagick

Prepare files for compiling:

sudo ./configure

Start Compiling:

sudo make

Once the compilation is done, install the program:

sudo make install

 

6. Compile your own C Program

If you want to write your program and use Build essential packages to compile your code to learn how it works then see our Tutorials:  How to create, compile & run a C Program in a Linux terminal

 

7. Remove or Uninstall build-essential from Ubuntu

Those who are interested in developing or in this package can remove it using:

sudo apt install build-essential
Other Articles:

 

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.