1

I am trying to compile a simple "hello world" C++ program on RHEL 7.9 using GNU Toolchain. After running "gcc -o a.out hello.cpp" I get the error "gcc: error trying to exec 'cc1plus': execvp: Permission denied". Here is the program below. I have installed gcc-7.2.0 and I have added its executable location to my PATH variable. Can anyone help? Thanks.

#include <iostream> using namespace std; int main(int argc, char *argv[]) { cout << "Hello World!" << endl; return 0; } 
5
  • Does this answer your question? Compile error: "g++: error trying to exec 'cc1plus': execvp: No such file or directory" Commented May 14, 2021 at 0:41
  • 1
    Can you explain how did you "installed gcc-7.2.0"? Commented May 14, 2021 at 0:45
  • @SamVarshavchik Hi Sam. GCC 4.8.5 was already installed. Then, I manually installed gcc-7.2.0 with "tar xzf..." using these instructions: benjaminberhault.com//post/2018/06/22/… After that, I was no longer able to compile anything with gcc. I re-installed gcc using "yum install devtoolset-7". I confirmed that gcc-7.2.0 is installed on my machine, but I still cannot compile anything. Thx! Commented May 14, 2021 at 22:34
  • @WillWalsh Hi Will. I did see that post and I tried several of the solutions mentioned in there, including adding gcc to my PATH, adding "cc1plus" to my PATH, and re-installing gcc-7.2.0, but the error is still there. Thx! Commented May 14, 2021 at 22:37
  • Manually installing software, in this fashion, on a Linux distribution controlled by a package manager, like RHEL's yum, will always end in tears. There is a reason why package managers exist: to make sure all packages get installed properly, won't overwrite each other files, and they make sure that all dependencies are met. gcc should've been installed with yum, originally. You likely ended up overwriting key files, resulting in an unstable system. The only practical solution is to reinstall RHEL, from scratch. Commented May 14, 2021 at 22:51

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.