./configure: Error: C Compiler Cc Is Not Found

Article with TOC
Author's profile picture

Kalali

Jun 07, 2025 · 3 min read

./configure: Error: C Compiler Cc Is Not Found
./configure: Error: C Compiler Cc Is Not Found

Table of Contents

    ./configure: error: c compiler cc is not found: A Troubleshooting Guide

    The dreaded "./configure: error: c compiler cc is not found" message is a common stumbling block for developers, especially when compiling software from source code. This error simply means the system's build process can't locate a C compiler. This comprehensive guide will walk you through the causes and effective solutions for this problem. Understanding this issue is crucial for anyone working with Linux, macOS, or other Unix-like systems.

    What Causes this Error?

    This error arises when the ./configure script, used by many open-source projects, cannot find the necessary tools to build the software. The most frequent cause is the absence of a C compiler or the system's inability to locate it within its standard search paths. This can stem from several issues:

    • Missing Compiler: The most obvious reason is that a C compiler (like GCC or Clang) isn't installed on your system.
    • Incorrect PATH Environment Variable: Even if the compiler is installed, the system might not know where to find it. This is usually related to the PATH environment variable, which tells the system where to search for executable files.
    • Wrong Compiler Name: The ./configure script might be looking for a specific compiler name (like cc), while a different name (like gcc) is actually used on your system.
    • Corrupted Installation: In rare cases, a faulty installation of the compiler or related build tools might lead to this error.

    Solving the "./configure: error: c compiler cc is not found" Problem

    Let's address these causes with practical solutions:

    1. Installing a C Compiler

    The first and most likely solution is to install a C compiler. The most common compilers are GCC (GNU Compiler Collection) and Clang. The installation process differs slightly based on your operating system:

    • Debian/Ubuntu (and other Debian-based distributions):
    sudo apt update
    sudo apt install build-essential
    

    The build-essential package usually includes GCC, the necessary libraries, and other build tools.

    • Fedora/CentOS/RHEL:
    sudo dnf install gcc
    

    Or, for a more comprehensive installation:

    sudo yum groupinstall "Development Tools"
    
    • macOS (using Homebrew):
    brew install gcc
    
    • macOS (using Xcode): Xcode's command-line tools include a C compiler. Install them from Xcode's preferences.

    2. Setting the PATH Environment Variable

    If you've already installed a compiler, the problem might lie in the PATH environment variable. This variable tells the system where to look for executable files. Here's how to check and set it:

    • Check your current PATH:
    echo $PATH
    
    • Temporarily setting PATH (for the current session): If the compiler's directory isn't included, add it temporarily. Replace /usr/bin with the actual directory where your compiler's executable resides (e.g., /usr/local/bin).
    export PATH="/usr/bin:$PATH"
    
    • Permanently setting PATH (Linux): This varies depending on your Linux distribution. You might need to edit your shell's configuration file (e.g., ~/.bashrc, ~/.zshrc). Add the line export PATH="/usr/bin:$PATH" (or the appropriate path) to this file, then source the file using source ~/.bashrc or source ~/.zshrc.

    • Permanently setting PATH (macOS): You can use the export command in your shell's profile, similar to Linux.

    3. Specifying the Compiler

    Some configure scripts are quite sensitive to the compiler name. If the script specifically requests cc, but you've installed gcc, you might need to explicitly specify the compiler using the CC environment variable:

    export CC=gcc
    ./configure
    

    4. Reinstalling Build Tools

    If none of the above steps resolve the issue, consider reinstalling your build tools. This could help address potential corruption. For Debian/Ubuntu, you could try:

    sudo apt-get purge build-essential
    sudo apt-get autoremove
    sudo apt-get install build-essential
    

    By systematically addressing these potential problems, you should be able to resolve the "./configure: error: c compiler cc is not found" issue and successfully compile your software. Remember to always check your system's documentation for specific instructions regarding compiler installation and environment variable management.

    Related Post

    Thank you for visiting our website which covers about ./configure: Error: C Compiler Cc Is Not Found . We hope the information provided has been useful to you. Feel free to contact us if you have any questions or need further assistance. See you next time and don't miss to bookmark.

    Go Home