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

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

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. Its the actual part that compiles C. For C++, theres 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++ 

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

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

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

Leave a Reply

Your email address will not be published.