https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91879
Bug ID: 91879 Summary: DESTDIR support seems incomplete Product: gcc Version: 9.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other Assignee: unassigned at gcc dot gnu.org Reporter: stsp at users dot sourceforge.net Target Milestone: --- Hello. I tried to build gcc with non-empty DESTDIR. It fails on libquadmath: In file included from ../../../gnu/gcc-9.2.0/libquadmath/math/x2y2m1q.c:19: ../../../gnu/gcc-9.2.0/libquadmath/quadmath-imp.h:24:10: fatal error: errno.h: No such file or directory 24 | #include <errno.h> | ^~~~~ The problem is that the system headers are searched in a prefix path that doesn't account for DESTDIR. This is because of the explicit -isystem in the command line. I looked at a build system and found that -isystem is built from the "tooldir" variable of the configure script. So I made the following change to confirm my findings: --- configure.ac.old 2019-09-24 03:44:28.141779422 +0300 +++ configure.ac 2019-09-24 03:30:59.022308759 +0300 @@ -2572,7 +2572,7 @@ # Some systems (e.g., one of the i386-aix systems the gas testers are # using) don't handle "\$" correctly, so don't use it here. -tooldir='${exec_prefix}'/${target_noncanonical} +tooldir='${DESTDIR}${exec_prefix}'/${target_noncanonical} build_tooldir=${tooldir} # Create a .gdbinit file which runs the one in srcdir And with that change the build worked. So I suppose this is a build system bug.