https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66634
Bug ID: 66634 Summary: Cross building native *-w64-mingw32 failed Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: major Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: dongsheng.song at gmail dot com Target Milestone: --- The cross compiler building fine, but when use it to build the native compiler, I got: make[2]: Entering directory '/home/cauchy/obj/native/gcc-6-win64/gcc/gcc' g++ -DIN_GCC -DGENERATOR_FILE -fno-PIE -no-pie -o build/genmddeps \ build/genmddeps.o build/read-md.o build/errors.o ../build-x86_64-unknown-linux-gnu/libiberty/libiberty.a g++: error: unrecognized command line option ‘-no-pie’ Makefile:2631: recipe for target 'build/genmddeps' failed Checking the gcc-6-win64/gcc/gcc/config.log, I found: configure:28726: checking for -fno-PIE option configure:28737: x86_64-w64-mingw32-g++ -c -g -fno-PIE conftest.cpp >&5 configure:28737: $? = 0 configure:28745: result: yes configure:28753: checking for -no-pie option configure:28764: x86_64-w64-mingw32-g++ -o conftest.exe -g -static-libstdc++ -static-libgcc -Wl,--stack,12582912 -no-pie conftest.cpp >&5 configure:28764: $? = 0 configure:28773: result: yes So the issue is gcc build script mixed up the target flags and the host flags.