Trying to build GCC 7.1.0 from source. This is not my first time and it used to work in past GCC releases.
../configure --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 \
--prefix=/c/mingw64 --with-sysroot=/c/mingw64 \
--with-gmp=/c/mingw64/gmp --with-mpfr=/c/mingw64/mpfr --with-mpc=/c/mingw64/mpc \
--with-isl=/c/mingw64/isl \
--disable-nls --disable-multilib --disable-libstdcxx-pch --disable-shared \
--disable-win32-registry --disable-libstdcxx-debug --disable-libstdcxx-verbose \
--with-tune=haswell --enable-lto --enable-checking=release --enable-languages=c,c++ \
--enable-libstdcxx-time --enable-threads=win32 --enable-libatomic --enable-fully-dynamic-string
Error
checking how to run the C++ preprocessor... /lib/cpp
configure: error: in `/c/mingw64/src/build/gcc':
configure: error: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details.
make[2]: *** [Makefile:4309: configure-stage2-gcc] Error 1
make[2]: Leaving directory '/c/mingw64/src/build'
make[1]: *** [Makefile:20550: stage2-bubble] Error 2
make[1]: Leaving directory '/c/mingw64/src/build'
make: *** [Makefile:936: all] Error 2
Complete config.log: https://pastebin.com/raw/mEeJHCuK
Note that I /lib/cpp
never exists.
I did some google search and tried every suggestions, including:
CXX=/c/mingw/bin/g++
(likewise to CC
and CPP
)/lib/cpp
in gcc-7.1.0/gcc/configure
with /c/mingw/bin/g++
. Which gave me:conftest.c:14:8: error: 'Syntax' does not name a type Syntax error ^
(^ is similar to Compiling on a mac: What does it mean if my compiler fails a sanity check?)
There was an old (critical) bug that seems related at https://gcc.gnu.org/ml/gcc-bugs/2015-10/msg00604.html , but no update.
CPP
should not point to g++
; CPP
is the C preprocessor, so make it point to the C preprocessor:
CPP=/c/mingw/bin/cpp
This is mentioned on the question you linked to.