How to Solve Source Compile Error configure: error: no acceptable C compiler found in $PATH in Linux Ubuntu

Description on The Error Triggered upon Compilation Process

This is an article similar with the previous article titled ‘How to Solve Source Compile Error configure: error: no acceptable C compiler found in $PATH in Linux CentOS’. The article exist in this link. The main problem is actually the same, it is the problem in the process of compiling source. There is a specific error similar with the other article in this link where it is also the title of this article. As shown in the similar article, the error given for an example actually exists in the process of compiling a PostgreSQL Database Server’s source. The output showing the error message is available below :

So, there is no acceptable C compiler found in $PATH as the error message in the above output shows. As a result, the continuation compilation process of PostgreSQL Database Server is not possible. The above error have a proper solution which is similar with the other article in this link. It is by installing a specific package or tool in Linux Ubuntu operating system distribution. Generally, in any Linux operating sytem distribution, the package or tool responsible for the compilation task is ‘gcc’. Before moving forward, the following is the information about the suitable package or tool available in Ubuntu for compiling process by executing the command ‘apt show gcc’ :

Steps taken to Solve Error Compilation Problem in Ubuntu 18.04. Looking for the ‘gcc’ tool.

For Ubuntu 18.04 Linux operating system distribution, the steps for installing the requirement package or tools for compiling source files are not totally different with the other Linux operating system distribution. It is shown below :

First step, just search the packages responsible for compiling process. In Ubuntu, there is a tool for managing software, packages or tools. It is the ‘apt’ package tool. In the early years, the specific package, tool representing a command for searching the appropriate package is the ‘apt-cache’ package tool. But nowadays, the ‘apt’ package tool is available for doing the same purpose with the additional argument ‘search’. Below. The following are those commands for searching the compiler package or tool :

The output shows the name of the package and also a short information about the package. The above command has a regular expression pattern specifying on the searching pattern. The pattern is to search an exact package or tool named ‘gcc’. Using the ‘apt’ package or tool can also achieve the above searching task process as follows :

Furthermore, check if the package or tool is available and it is ready to use. How to check an installed package or tool in the Ubuntu Linux operating system ?. Below is the actual command to check if the package or tool with the name of ‘gcc’ is already exist :

apt list --installed | grep gcc

The output of the command execution is shown below :

root@hostname:~# apt list --installed | grep gcc
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
root@hostname:~#

Steps taken to Solve Error Compilation Problem in Ubuntu 18.04. An alternative package or tool named ‘build-essential’.

Apparently, based on the above output command execution, the package or tool named ‘gcc’ is not installed yet. But fortunately, in Ubuntu Linux operating system distribution there is another package which is appropriate and it is suitable for the installation process. It is the ‘build-essential’ package. Before installing ‘build-essential’, below is the detail information about the package. The information is available by executing the command ‘apt show build-essential’ as follows :

root@hostname:~# apt show build-essential
Package: build-essential
Version: 12.4ubuntu1
Priority: optional
Build-Essential: yes
Section: devel
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Matthias Klose <doko@debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 20,5 kB
Depends: libc6-dev | libc-dev, gcc (>= 4:7.2), g++ (>= 4:7.2), make, dpkg-dev (>= 1.17.11)
Supported: 5y
Download-Size: 4.758 B
APT-Manual-Installed: yes
APT-Sources: http://id.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
Description: Informational list of build-essential packages
If you do not plan to build Debian packages, you don't need this
package. Starting with dpkg (>= 1.14.18) this package is required
for building Debian packages.
.
This package contains an informational list of packages which are
considered essential for building Debian packages. This package also
depends on the packages on that list, to make it easy to have the
build-essential packages installed.
.
If you have this package installed, you only need to install whatever
a package specifies as its build-time dependencies to build the
package. Conversely, if you are determining what your package needs
to build-depend on, you can always leave out the packages this
package depends on.
.
This package is NOT the definition of what packages are
build-essential; the real definition is in the Debian Policy Manual.
This package contains merely an informational list, which is all
most people need. However, if this package and the manual disagree,
the manual is correct.
root@hostname:~#

So, how can installing build-essential can also automatically install ‘gcc’ package or tool ?. Below is the information where it is specifically giving the package dependencies information. It means, the success of installing ‘build-essential’ package or tool depends on these lists of package or tools. These lists of package or tools must be exist before the installation of ‘build-essential’ can start. In other words, there is a checking process for the availability of those lists of packages or tools. If those packages or tools are not available, ‘apt’ will install those packages or tools first. The following is the command execution to provide the dependency packages or tools information :

Based on the output of the command above, it is better to install build-essential because there are lots of useful package or tool aside from ‘gcc’ will be available by only installing ‘build-essential’ package.

First of all, check the availability of package or tool. Below is the command to accomplish the task :