I have been successfully using gcc on Linux Mint 12. Now I am getting an error. I have recently been doing some .so builds and installed Clang not to long ago, but have successfully compiled since both of those events, so not sure what has changed. I used the GUI Software Manager to remove and then install gcc again, but the results are the same:
~/code/c/ut: which gcc
/usr/bin/gcc
~/code/c/ut: gcc -std=c99 -Wall -Wextra -g -c object.c
gcc: error trying to exec 'cc1': execvp: No such file or directory
On CentOS or Fedora
I ran into a similar issue today - a co-worker could not build his software but I could build it. When he ran
gcc
it could not findcc1
.His executable path looked reasonable but the fact that I could not easily replicate the failure suggested something in his environment as the cause.
Eventually we found
GCC_EXEC_PREFIX
defined in his environment which was the culprit and was misleadinggcc
in the search forcc1
. This was part of his shell startup scripts and was meant to work around a limitation on a SPARC/Solaris system that is no longer in use. The problem was resolved by not setting this environment variable.http://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html
Just to document my trouble with this issue even though it just appears to be a specific example of other answers; as a relative newbie I feel like this might help others.
Solution:
I added '/usr/bin' to the beginning of PATH for a single session using
PATH='/usr/path/:$PATH'
and everything started to work fine.I used gedit to update the PATH permanently, after ensuring it wouldn't break my regular toolchains.
Explanation:
I have multiple toolchains installed on Ubuntu 14.04LTS and I use just a couple on a regular basis. When I tried to use gcc from the command line I got the issue describe by the OP. '/usr/bin' is in the PATH but it is behind the other toolchain locations. Turns out the cc1 for those other toolchains is incompatible with gcc.
yum install gcc-c++
did the fix.