On Thu, Oct 22, 2020 at 4:55 AM Harsh Rathod via Gcc-help < gcc-help@xxxxxxxxxxx> wrote: > Hello there, > I'm trying to build GCC 10.2 for host and target MinGW on my Fedora 23 OS. > I've configured it like this: > ../gcc-10.2.0/configure --host=x86_64-w64-mingw32 > --target=x86_64-w64-mingw32 --prefix=/usr/local/gcc-mingw --enable-shared > --enable-languages=c,c++ --disable-multilib > > But I get this weird error on make: > x86_64-w64-mingw32-gcc -xc -nostdinc /dev/null -S -o /dev/null > -fself-test=../../gcc-10.2.0/gcc/testsuite/selftestsx86_64-w64-mingw32-gcc: > error: unrecognized command line option > '-fself-test=../../gcc-10.2.0/gcc/testsuite/selftests'../../gcc-10.2.0/gcc/c/Make-lang.in:124: > recipe for target 's-selftest-c' failedmake[2]: *** [s-selftest-c] Error > 1rm gcc.podmake[2]: Leaving directory '/root/gcc-mingw/gcc'Makefile:4418: > recipe for target 'all-gcc' failedmake[1]: *** [all-gcc] Error 2make[1]: > Leaving directory '/root/gcc-mingw'Makefile:977: recipe for target 'all' > failedmake: *** [all] Error 2 > What is it that I'm doing wrong here? > Normally the selftest uses ./xgcc, but since you are doing a canadian cross, ./xgcc is a windows binary that won't run on the build machine, so it uses the fedora-x-mingw cross compiler instead. Except that it appears that you are using the system cross compiler which is an old version that doesn't support the -fselftest option. The solution is to first build a gcc-10 fedora-x-mingw cross compiler. And then use that cross compiler to build a fedoar-x-mingw-x-mingw cross compiler. Taking a higher level view of this, maybe the selftest support should be disabled when build != host, since it won't do anything meaningful in that case. That would allow cross builds with older gcc versions. Ideally, the selftest should be run on the host machine after the compiler is built and installed there. We do create an install-tools dir in the gcc install tree, with some scripts that are meant to be run on the host machine, like a script to rerun fixincludes if the header files on the host change. We could maybe add a script that runs selftest, but selftest requires the dejagnu testsuite support, plus the selftest testsuite itself. That is probably too much to easily copy into the install-tools dir. Jim