https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91879
--- Comment #12 from Stas Sergeev <stsp at users dot sourceforge.net> --- (In reply to jos...@codesourcery.com from comment #11) > Those -isystem paths are the *non-sysroot* kind of paths for headers for a > cross compiler. Unfortunately I wasn't able to fully understand the idea you explain. You mention "sysroot" and "non-sysroot" builds, and you suggest to use --with-build-sysroot= together with --with-sysroot= (without providing an example of how to set --with-build-sysroot=, so I assume it should be equal to $DESTDIR). May I assume that in the "sysroot" build all the -isystem pathes will be changed the way the sysroot prefix is replaced with build-sysroot prefix during libs build? OTOH I found a very simple way of implementing the Andrew Pinski suggestion. Here it is: ------- --- configure.ac.old 2019-09-25 17:00:34.973324924 +0300 +++ configure.ac 2019-09-25 17:45:33.958152993 +0300 @@ -2327,6 +2327,7 @@ [use sysroot as the system root during the build])], [if test x"$withval" != x ; then SYSROOT_CFLAGS_FOR_TARGET="--sysroot=$withval" + build_sysroot_path=${withval} fi], [SYSROOT_CFLAGS_FOR_TARGET=]) AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET) @@ -2573,7 +2574,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} -build_tooldir=${tooldir} +build_tooldir=${build_sysroot_path}${tooldir} # Create a .gdbinit file which runs the one in srcdir # and tells GDB to look there for source files. ------ What do you think guys? Does it break something? It definitely works for me.