I've just tried to install APCUPSD and have run into a missing C compiler error. I then ran

yum install compat-gcc-34-g77

which went fine but the error did not go away, I tried

which gcc

as well as

which compact-gcc

both returned the errors

/usr/bin/which: no gcc in

how do I make sure it is in the $PATH?


I should probably mention the path to where the gcc is


1 Answer 1


You have to add the path /usr/lib/gcc/x86_64-redhat-linux/ to your $PATH environment variable.

Put in a line in ~/.profile as follows:


It will add the path to the variable. But in the current session, the file must be sourced again to be applied. Use that command for that:

. ~/.profile

Then which gcc should reply the correct path.

  • Adding the location to the PATH isn't the problem it's just that even when I add it it doesn't find the gcc, I'm not sure how to check where the right location is to add Jan 30, 2015 at 8:39
  • When which doesn't find it, then its not in the PATH. Make sure the directory containing the executable gcc is in the $PATH (not a parent or something, exactly that directory). You can check your PATH with echo $PATH. And also make sure it is executable. Try is with /usr/lib/gcc/x86_64-redhat-linux/3.4.6/gcc --version Is there an output?
    – chaos
    Jan 30, 2015 at 8:47
  • thats exactly where the problem lies, there is no executable gcc in that directory. when I use whereis gcc it gives me that location though Jan 30, 2015 at 8:52
  • I found the problem, the gcc had been uninstalled incorrectly so it only looked like it was there, an incredibly frustrating situation Jan 30, 2015 at 8:56
  • Im still going to mark that as the correct answer because you helped me to confirm that it was definitely not there, thanks bro Jan 30, 2015 at 8:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .