Configure error: no acceptable C compiler found in $PATH

avatar
Borislav Hadzhiev

Last updated: Apr 11, 2024
2 min

banner

# Configure error: no acceptable C compiler found in $PATH

The error "Configure error: no acceptable C compiler found in $PATH" occurs when you don't have a gcc compiler in your $PATH environment variable.

To solve the error, make sure you have gcc installed and present in your $PATH.

If you are on Debian (Ubuntu), use the following command to install gcc.

shell
# Debian (Ubuntu) apt-get install build-essential # If you get a permissions error sudo apt-get install build-essential

install build essential

If you get an error that "the package can not be found", issue the following commands on Debian.

shell
# Debian (Ubuntu) sudo apt update sudo apt install -y build-essential

If you are on Redhat (CentOS), issue the following commands.

shell
# RHEL/CentOS yum groupinstall "Development Tools" -y yum install gcc -y # If you get a permissions error sudo yum groupinstall "Development Tools" -y sudo yum install gcc -y

The Development Tools group (RHEL/CentOS/Fedora/Red Hat) include core development tools such as gcc, automake, perl, python.

There tools are required to compile software.

If the error persists and you are on CentOS, run the following command.

shell
# RHEL/CentOS yum install gcc glibc glibc-common gd gd-devel -y # If you get a permissions error sudo yum install gcc glibc glibc-common gd gd-devel -y

If you are on openSUSE, run the following command instead.

shell
# openSUSE zypper install --type pattern devel_basis

If you are on Alpine Linux, issue the following command.

shell
# Alpine Linux apk add build-base

If the issue persists on Alpine, run the following command.

shell
# Alpine Linux apk --update add gcc make g++ zlib-dev

If you are on Arch Linux, run the following command instead.

shell
# Arch Linux sudo pacman -S base-devel

The build-essential package is required for building Debian packages.

The build-essential package depends on (and installs) the following packages:

  • dpkg-dev - Debian package development tools.
  • g++ - GNU C++ compiler.
  • gcc - GNU C compiler.
  • libc6-dev - GNU C Library: Development libraries and header files.
  • make - Utility for directing compilation.

Try to run the gcc --version command after having installed build-essential or Development tools.

# Solving the error in a shared hosting environment

If you are in a shared hosting environment, the sudo, apt and gcc commands will be disabled by default.

Try to issue the gcc --version command in your terminal.

shell
gcc --version

issue gcc version command

If you get the error "Permission denied", then you have gcc installed but you don't have the necessary permissions to issue the command.

You have to contact the support of your shared hosting provider and tell them to add you to the compiler group.

# Additional Resources

You can learn more about the related topics by checking out the following tutorials:

I wrote a book in which I share everything I know about how to become a better, more efficient programmer.
book cover
You can use the search field on my Home Page to filter through all of my articles.