I tried to run ./configure on a small program that the Linux book I'M reading instructed me to download and I got the error "no acceptable C compiler found in $PATH" I then tried to run atp-get install gcc, but then I got "unable to locate package gcc". Any dieas?

Dani AI

Generated

The configure error "no acceptable C compiler found in $PATH" simply means the build script couldn’t find a C compiler binary (typically gcc or cc) in any of the directories listed in your PATH. Quick checks that show whether a compiler exists and where your shell is looking:

command -v gcc || command -v cc
gcc --version
echo $PATH

About the "unable to locate package" behaviour: the Debian/Ubuntu package tools use a local index of repository metadata (stored under /var/lib/apt/lists). A fresh or recently-installed system won’t have that index until you refresh it, so install attempts will fail with “unable to locate package.” Network problems or a misconfigured /etc/apt/sources.list (or missing universe/main components on Ubuntu) can produce the same symptom.

To diagnose further, verify installed compiler packages and policy, and confirm your repos are reachable:

dpkg -l 'gcc*' 2>/dev/null | grep '^ii'
apt-cache policy gcc

If a compiler is present but ./configure still fails, either the binary name isn’t what configure expects or it isn’t on PATH. You can point configure at a specific compiler or temporarily prepend a directory to PATH:

CC=/usr/bin/gcc ./configure
export PATH="/usr/local/bin:$PATH"

Summary tied to earlier replies: ’s suggestion to install the development meta-package is the usual fix; correctly noted that minimal Ubuntu images omit development headers; and ’s real solution was refreshing the package index. Use the checks above to confirm whether you lack a compiler, need to refresh repo metadata, or must adjust PATH.

Recommended Answers

All 3 Replies

Try to install build-essential (at least, in Ubuntu repos, I don't know if other debian distros have it too), it will install everything you need.

$ sudo apt-get install build-essential

Also, if you get the message "unable to locate package ..", then you should try to do a search for it:

$ sudo aptitude search gcc

It should list all packages that contain that word (like grep). It's possible that the package is named something else, like gcc-4.7 or something like that.

Thanks. It worked but it took me a while. I had to run apt-get update first. I alwasy forget that after I've just installed a new server. Since we're on the subject, why do simple apt-get commands not work until upate has been run?

apt-get update , Updates the "local database" of what is available (in the Terabtytes) on the clouds...
sudo apt-get install build-essential libc6-dev libbz2-dev check
Ubuntu lacks the above by default

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.