https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91879
--- Comment #16 from Stas Sergeev <stsp at users dot sourceforge.net> --- (In reply to Jonathan Wakely from comment #15) > For the record, this has moved to > https://gcc.gnu.org/ml/gcc-help/2019-10/msg00002.html Thanks, I also would like to apologize to Joseph for not following his suggestion and instead keeping to fight with the gcc build system. I can't help feeling there is a bug here, and I think I am quite close to getting it solved, so I'd be upset having to change the approach after so many investigations, at least for now. I've found this patch of Paolo Bonzini: https://gcc.gnu.org/ml/gcc-patches/2006-01/msg00823.html --- (GCC_TARGET_TOOL): Do not use a host tool if we found a target tool with a complete path in either $with_build_time_tools or $exec_prefix. --- That made me think that --with-build-time-tools= should override the in-tree tools, but it is not what actually happens. More details here: https://gcc.gnu.org/ml/gcc-help/2019-10/msg00002.html Basically, the idea was to build one djgpp on host, and then use that one for building the target libs in another build tree. But it doesn't pick up the host-installed tools. After looking at the Paolo's patch, I tried the following change: --- config/acx.m4.old 2019-10-02 02:39:31.976773572 +0300 +++ config/acx.m4 2019-10-02 02:08:57.223563920 +0300 @@ -522,7 +522,7 @@ fi else ifelse([$4],,, - [ok=yes + [ok=no case " ${configdirs} " in *" patsubst([$4], [/.*], []) "*) ;; *) ok=no ;; And indeed got the build done, as --with-build-time-tools= now found all the host tools in preference of the in-tree tools. So currently I suspect Paolo's patch is at fault.