Hi GCC team, I have successfully built GCC 7.1.0 on Windows 10 x64 with GCC 6.3.0 and Binutils 2.27.
Output of src/config.guess: x86_64-pc-mingw64 Output of gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=c:/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/7.1.0/lto-w rapper.exe Target: x86_64-w64-mingw32 Configured with: ../configure --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw 32 --target=x86_64-w64-mingw32 --prefix=/c/mingw64 --with-sysroot=/c/mingw64 --w ith-gmp=/c/mingw64/gmp --with-mpfr=/c/mingw64/mpfr --with-mpc=/c/mingw64/mpc --w ith-isl=/c/mingw64/isl --disable-nls --disable-multilib --disable-libstdcxx-pch --disable-shared --disable-win32-registry --disable-libstdcxx-debug --disable-li bstdcxx-verbose --with-tune=haswell --enable-lto --enable-checking=release --ena ble-languages=c,c++ --enable-libstdcxx-time --enable-threads=win32 --enable-liba tomic --enable-fully-dynamic-string Thread model: win32 gcc version 7.1.0 (GCC) Notes: 1. I can't build GMP, MPFR, MPC and ISL in-tree. 2. I was getting this error message in stage 2: configure: error: in `/c/mingw64/src/build/gcc': configure: error: C++ preprocessor "/lib/cpp" fails sanity check Workaround: export CPP=<old gcc>/bin/cpp And manually replace all occurrences of "/lib/cpp" in src/gcc/configure with "<old gcc>/bin/cpp" 3. For some reasons I do not know, stage 2 can't find Mingw64 runtime includes and libraries even though I already ran these commands in target root (standard procedure for Windows, used to work when I built GCC 6.3.0): cp -r x86_64-w64-mingw32/lib x84_64-w64-mingw32/lib64 cp -r x86_64-w64-mingw32 mingw mkdir -p gcc-6.3.0/gcc/winsup/mingw cp -r x86_64-w64-mingw32/include gcc-6.3.0/gcc/winsup/mingw Workaround: export CPATH=/c/mingw64/mingw/include export LIBRARY_PATH=/c/mingw64/mingw/lib 4. I was building GCC with make BUILD_CONFIG=bootstrap-lto and got error messages about missing stpcpy and sys_siglist during linking. Workaround: Apply the following patch. --- a/Makefile.in +++ a/Makefile.in @@ -22383,7 +22383,7 @@ configure-libiberty: $$s/$$module_srcdir/configure \ --srcdir=$${topdir}/$$module_srcdir \ $(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \ - --target=${target_alias} @extra_host_libiberty_configure_flags@ \ + --target=${target_alias} libiberty_cv_var_sys_siglist=no @extra_host_libiberty_configure_flags@ \ || exit 1 @endif libiberty @@ -22419,7 +22419,7 @@ configure-stage1-libiberty: --target=${target_alias} \ \ $(STAGE1_CONFIGURE_FLAGS) \ - @extra_host_libiberty_configure_flags@ + libiberty_cv_var_sys_siglist=no @extra_host_libiberty_configure_flags@ @endif libiberty-bootstrap .PHONY: configure-stage2-libiberty maybe-configure-stage2-libiberty @@ -22453,7 +22453,7 @@ configure-stage2-libiberty: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGE2_CONFIGURE_FLAGS) \ - @extra_host_libiberty_configure_flags@ + libiberty_cv_var_sys_siglist=no @extra_host_libiberty_configure_flags@ @endif libiberty-bootstrap .PHONY: configure-stage3-libiberty maybe-configure-stage3-libiberty @@ -22487,7 +22487,7 @@ configure-stage3-libiberty: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGE3_CONFIGURE_FLAGS) \ - @extra_host_libiberty_configure_flags@ + libiberty_cv_var_sys_siglist=no @extra_host_libiberty_configure_flags@ @endif libiberty-bootstrap .PHONY: configure-stage4-libiberty maybe-configure-stage4-libiberty @@ -22521,7 +22521,7 @@ configure-stage4-libiberty: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGE4_CONFIGURE_FLAGS) \ - @extra_host_libiberty_configure_flags@ + libiberty_cv_var_sys_siglist=no @extra_host_libiberty_configure_flags@ @endif libiberty-bootstrap .PHONY: configure-stageprofile-libiberty maybe-configure-stageprofile-libiberty @@ -22555,7 +22555,7 @@ configure-stageprofile-libiberty: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEprofile_CONFIGURE_FLAGS) \ - @extra_host_libiberty_configure_flags@ + libiberty_cv_var_sys_siglist=no @extra_host_libiberty_configure_flags@ @endif libiberty-bootstrap .PHONY: configure-stagefeedback-libiberty maybe-configure-stagefeedback-libiberty @@ -22589,7 +22589,7 @@ configure-stagefeedback-libiberty: --target=${target_alias} \ --with-build-libsubdir=$(HOST_SUBDIR) \ $(STAGEfeedback_CONFIGURE_FLAGS) \ - @extra_host_libiberty_configure_flags@ + libiberty_cv_var_sys_siglist=no @extra_host_libiberty_configure_flags@ @endif libiberty-bootstrap --- a/libiberty/Makefile.in +++ a/libiberty/Makefile.in @@ -112,7 +112,8 @@ INCDIR=$(srcdir)/$(MULTISRCTOP)../include COMPILE.c = $(CC) -c @DEFS@ $(CFLAGS) $(CPPFLAGS) -I. -I$(INCDIR) \ - $(HDEFINES) @ac_libiberty_warn_cflags@ -D_GNU_SOURCE + $(HDEFINES) @ac_libiberty_warn_cflags@ -D_GNU_SOURCE \ + -fno-builtin-stpcpy # Just to make sure we don't use a built-in rule with VPATH .c.$(objext): The patch is modified slightly from attachment in last comment of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66014 (a 2 years old bug). I did not run the testsuite, but it seems to work fine with my old codes and some example C++17 snippets. Sincerely, Loo Rong Jie