g++: fatal error: cannot execute ‘d21’: execvp: No such file or directory compilation terminated

34 views Asked by At

When I try to compile a QT project it gives this error: g++: fatal error: cannot execute ‘d21’: execvp: No such file or directory I have also tried to include full path of file while compiling but same error occured. Just to be sure of version mismatch I looked for both gcc and g++ version but both are same, gcc/g++ version: 9.4.0.

When I try to compile a QT project it gives this error: g++: fatal error: cannot execute ‘d21’: execvp: No such file or directory.

2

There are 2 answers

0
273K On

d21 is the D programming language GCC driver. You need to install GDC, D programming language support in GCC.

0
wreckgar23 On

I got this error myself when building an application with the cmake Ninja generator. A variable preceding DEP_FILE had a newline in its string value, which caused gcc to try and treat the dependency file as if it was a D source file.

The fix for me was to add OUTPUT_STRIP_TRAILING_WHITESPACE to the execute_process command that was generating the problematic variable in cmake.

I would suggest inspecting generated build files like build.ninja (if you're using the Ninja generator) to see if you're getting a similar problem. Or it may be obvious from the command-line that generates the error that some corruption of variables is going on.

You may also find that the issue goes away if you use a different cmake generator (assuming that you're building a cmake project).