Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gcc error: gcc: error trying to exec 'cc1': execvp: No such file or directory

Tags:

gcc

Explanation

The error message told us, that the build-time dependency (in this case it is cc1) was not found, so all we need — install the appropriate package to the system (using package manager // from sources // another way)

What is cc1:

cc1 is the internal command which takes preprocessed C-language files and converts them to assembly. It's the actual part that compiles C. For C++, there's cc1plus, and other internal commands for different languages.

taken from this answer by Alan Shutko.

Solution for: Ubuntu / Linux Mint

sudo apt-get update
sudo apt-get install --reinstall build-essential

Solution for: Docker-alpine environment

If you are in docker-alpine environment install the build-base package by adding this to your Dockerfile:

RUN apk add build-base

Better package name provided by Pablo Castellano. More details here.

If you need more packages for building purposes, consider adding of the alpine-sdk package:

RUN apk add alpine-sdk

Taken from github

Solution for: CentOS/Fedora

This answer contains instructions for CentOS and Fedora Linux

Solution for: Amazon Linux

sudo yum install gcc72-c++

Taken from this comment by CoderChris

You could also try to install missed dependencies by this (though, it is said to not to solve the issue):

sudo yum install gcc-c++.noarch

Taken from this answer


On CentOS or Fedora

yum install gcc-c++ 

On debian / ubuntu I fixed this problem by reinstalling build-essential:

sudo apt-get update
sudo apt-get install --reinstall build-essential

This is because gcc calls many other executables to complete the processing of the input, and cc1 is not in the included path.

On shell type whereis cc1. If cc1 is found, it's better go ahead and create a softlink in the directory of gcc; otherwise, cc1 is not installed and you have to install gcc-c++ using the package manager.


Amazon Linux: fixing GCC issue

Since this comes up as the first result on Google, I just wanted to document my experience with Amazon Linux. Installing gcc-c++.noarch fixed the problem:

sudo yum install gcc-c++.noarch

Some people also reported this alternative as a solution:

sudo yum install gcc72-c++