1

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.

  • 1
    The output of g++ --print-prog-name=cc1plus should tell you where g++ is looking – steeldriver Mar 6 at 21:51
  • It just says =cc1plus – Josh Zindler Mar 6 at 22:22
  • Let's take a step back: are you actually trying to cross-compile for ARM on x86_64? what does type -a g++ say? – steeldriver Mar 6 at 22:33
  • Yes I am trying to cross compile, and the output of that command is: g++ is /usr/bin/g++ – Josh Zindler Mar 6 at 22:42
  • 2
    Since you’re trying to cross-compile, you can pretty much ignore gcc/g++; what’s interesting is arm-linux-gnueabihf-g++. What do arm-linux-gnueabihf-gcc --version and arm-linux-gnueabihf-g++ --version output? What does arm-linux-gnueabihf-g++ -print-prog-name=cc1plus output? – Stephen Kitt Mar 7 at 7:39
0

I fixed the problem!

To fix the cc1plus error:

The first issue was that since I am cross-compiling so I needed to first install OpenSSL on my raspberry pi and then copy that library back over to my PC.

Then I had to get a fresh copy of my sysroot folder (which was for some reason corrupted), and place my OpenSSL inside it.

Then additional errors came up saying "cannot find crt1.0, crti.o, crtn.o, and libdl.so.2: No such file or directory":

To fix these I had to create symbolic links in my sysroot folder to point to where these files were from the location the compiler was expecting them to be in.

And now my project compiles!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.