Full error message:
arm-linux-gnueabihf-g++: error trying to exec 'cc1plus': execvp: No such file or directory
So I have got this error message while trying to build a C++ project on my machine shortly after a home directory deletion and recovery on Ubuntu 18.04. I'm doubtful that this is because of something in my environment since I built my program not too long ago with the same settings. After researching the error, I found that pretty much everyone says that it's because I have either not installed gcc/g++, incorrectly installed gcc/g++, or have a version mismatch between gcc/g++.
However this appears to not be my problem:
jayz@joshz:/usr$ gcc --version
gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
jayz@joshz:/usr$ g++ --version
g++ (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I have also tried reinstalling both gcc and g++ but still the same error appears.
I have also tried:
sudo apt-get update
sudo apt-get install --reinstall build-essential
I have in fact found the cc1plus file on my system in multiple places:
jayz@joshz:/usr$ locate cc1plus
/home/jayz/raspi/sysroot/usr/lib/gcc/arm-linux-gnueabihf/4.9/cc1plus
/home/jayz/raspi/tools/arm-bcm2708/arm-bcm2708-linux-gnueabi/libexec/gcc/arm-bcm2708-linux-gnueabi/4.7.1/cc1plus
/home/jayz/raspi/tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/libexec/gcc/arm-bcm2708hardfp-linux-gnueabi/4.7.1/cc1plus
/home/jayz/raspi/tools/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/libexec/gcc/arm-linux-gnueabihf/4.9.3/cc1plus
/home/jayz/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/libexec/gcc/arm-linux-gnueabihf/4.8.3/cc1plus
/home/jayz/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/libexec/gcc/arm-linux-gnueabihf/4.8.3/cc1plus
/usr/lib/gcc/x86_64-linux-gnu/7/cc1plus
so perhaps it's a linker issue?
One thing that I have noticed is that I have no /usr/local/libexec or /usr/libexec directories but I am not sure if this is a problem or what it might imply.
g++ --print-prog-name=cc1plus
should tell you whereg++
is lookingtype -a g++
say?gcc
/g++
; what’s interesting isarm-linux-gnueabihf-g++
. What doarm-linux-gnueabihf-gcc --version
andarm-linux-gnueabihf-g++ --version
output? What doesarm-linux-gnueabihf-g++ -print-prog-name=cc1plus
output?