https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91879
--- Comment #3 from Stas Sergeev <stsp at users dot sourceforge.net> --- (In reply to Harald van Dijk from comment #1) > archive from the DESTDIR directory and extracting it elsewhere. It is not > supposed to be used at configure time to pick up other software, only at > install time to determine the location to install into. Yes, I understand that. And yet what I see is that when gcc is building its libs, it looks for the system headers under prefix, not under destdir. But you are right, I probably should try mail list for the help with that. (In reply to Jonathan Wakely from comment #2) > (In reply to Stas Sergeev from comment #0) > > Hello. > > > > I tried to build gcc with non-empty DESTDIR. > > What exact commands did you run? I have the script that runs basically "make all-gcc" and "make" after setting some env vars. And what fails is the plain "make" step. I can show you how exactly: --- libtool: compile: /home/stas/src/build-gcc/build/djcross-gcc-9.2.0/djcross/./gcc/xgcc -B/home/stas/src/build-gcc/build/djcross-gcc-9.2.0/djcross/./gcc/ -B/usr/local/cross/i586-pc-msdosdjgpp/bin/ -B/usr/local/cross/i586-pc-msdosdjgpp/lib/ -isystem /usr/local/cross/i586-pc-msdosdjgpp/include -isystem /usr/local/cross/i586-pc-msdosdjgpp/sys-include -DHAVE_CONFIG_H -I. -I../../../gnu/gcc-9.2.0/libquadmath -I ../../../gnu/gcc-9.2.0/libquadmath/../include -g -O2 -MT math/x2y2m1q.lo -MD -MP -MF math/.deps/x2y2m1q.Tpo -c ../../../gnu/gcc-9.2.0/libquadmath/math/x2y2m1q.c -o math/x2y2m1q.o 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> | ^~~~~~~~~ compilation terminated. --- > I don't see why DESTDIR should matter until the 'make install' step. Please note the -isystem /usr/local/cross/i586-pc-msdosdjgpp/include -isystem /usr/local/cross/i586-pc-msdosdjgpp/sys-include above. Clearly it misses the DESTDIR, and feeding the DESTDIR there makes the problem to go away.