Compile Error: "G++: Error Trying to Exec 'Cc1Plus': Execvp: No Such File or Directory"

Compile error: g++: error trying to exec 'cc1plus': execvp: No such file or directory

You need to install gcc-c++ package.

yum install gcc-c++

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

The routine commands that saved me time after time for such errors:

sudo apt update
sudo apt upgrade
sudo apt install gcc python3-dev python3-pip libxml2-dev libxslt1-dev zlib1g-dev g++

Hope it works.

gcc without full path: error trying to exec 'cc1': execvp: No such file or directory

I solved this problem with simple solution.

export PATH

After this command, compile with relative path will be succeed.


Roads to found this:

  • I test if add PATH to libexec can compile.

$ PATH=${PATH}:/usr/libexec/gcc/i686-test-linux/8.3.0/ -> Successful

According to strace log, I think gcc does not use $PATH to search cc1/cc1plus. Why?

  • I test if PATH to /usr/bin can compile. (by mistake)

$ PATH=${PATH}:/usr/bin -> Successful

  • Why this success? I think PATH already contains "/usr/bin"
$ echo ${PATH}
/sbin:/usr/sbin:/bin:/usr/bin
  • I test if passed $PATH simply.

$ PATH=${PATH} gcc -> Successful

  • What the difference between $ gcc and $ PATH=$PATH gcc???
$ set
HOME='/'
HOSTNAME='TEST0'
IFS='
'
LINENO=''
OLDPWD='/'
OPTIND='1'
PATH='/sbin:/usr/sbin:/bin:/usr/bin'
PPID='2701'
PS1='\w \$ '
PS2='> '
PS4='+ '
PWD='/'
SHLVL='8'
TERM='linux'
$ export
export HOME='/'
export OLDPWD='/'
export PWD='/'
export SHLVL='8'
export TERM='linux'

Oh, PATH is not exported as environment variables. only existed as shell variables...

Android ndk-r8 error trying to exec 'cc1plus': execvp: No such file or directory

I have experienced same error.

I was not able to execute even 'gcc, g++' command. So I have googled a lot to find solution, but nothing helped for me.

Then, I found that some filename in ndk is not correct, with tailing _ on some filename.. (In my case, in toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/arm-linux-androideabi/bin folder, there are gcc_, g++_, c++_ instead of gcc, g++, c++.)

I used The unarchiver to extract NDK archive, so I think there are something wrong with unarchiving procedure.

So I re-downloaded NDK and checked MD5 checksum, then extracted archive using Mac's default archive utility.

Now, the problem has solved.



Related Topics



Leave a reply



Submit