Cross-compilation fails with "g++ not found"

Last edited on

Symptom

A cross-compilation build from sources runs into the problem during the configure run with the following error:

Using Source directory: /home/user/squish-6.0.0-qt-embedded-src
Using Build directory: /home/user/Squish/squish-6.0.0-qt-embedded-src
Using g++ compiler for bootstrapping
Compiling configure and build ...
make: g++: Command not found
make: *** [ext_std.o] Error 127

Possible Cause and Suggested Solution

While the XCXX environment variable should be set to the cross-compiler the build will still require a compiler producing helper tools native to the host. Unless override with CXX on Linux the GNU compiler g++ is being used.

If above error occurs this typically means two things:

  1. The host system lacks installation of a C++ compiler. On systems with a Debian or Ubuntu base this can be fixed by issuing

    apt-get install g++

    as root user.

  2. The g++ executable is installed but not found in one of the directories specified in the PATH variable. Inspect its current value with

    echo $PATH

    and add the directory containing the host g++ compiler with:

    PATH=/path/to/host/compiler/bin:$PATH

Before running the configure script again the following check can be made:

which g++

This return the absolute path of g++. If there is no output re-check the value of PATH.