title: Why does GCC (MinGW-w64) return a 'fatal error: no input files' when building MPFR?
body: <p>I'm unable to diagnose the cause of an error when attempting to build MPFR 4.0.1 with MinGW-w64 8.1.0. I'm using msys2 and Windows 10. The result of running mingw32-make is:</p>
  
  <pre><code>$ make
  Making all in doc
  make[1]: Entering directory 'C:/development-personal-builds/mpfr-4.0.1/build-1/doc'
  make[1]: Nothing to be done for 'all'.
  make[1]: Leaving directory 'C:/development-personal-builds/mpfr-4.0.1/build-1/doc'
  Making all in src
  make[1]: Entering directory 'C:/development-personal-builds/mpfr-4.0.1/build-1/src'
  C:/development-tools/mingw-w64-8.1.0/mingw64/bin/make  all-am
  make[2]: Entering directory 'C:/development-personal-builds/mpfr-4.0.1/build-1/src'
  C:/development-tools/msys2/usr/bin/sh.exe ../libtool  --tag=CC   --mode=compile gcc -DMPFR_WANT_ASSERT=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_DOUBLE_IEEE_LITTLE_ENDIAN=1 -DHAVE_LITTLE_ENDIAN=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_LOCALE_H=1 -DHAVE_WCHAR_H=1 -DHAVE_STDARG=1 -DHAVE_SYS_TIME_H=1 -DHAVE_STRUCT_LCONV_DECIMAL_POINT=1 -DHAVE_STRUCT_LCONV_THOUSANDS_SEP=1 -DHAVE_VA_COPY=1 -DHAVE_SETLOCALE=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_SIGNAL=1 -DHAVE_LONG_LONG=1 -DHAVE_INTMAX_T=1 -DMPFR_HAVE_INTMAX_MAX=1 -DMPFR_PRINTF_MAXLM=\"ll\" -DMPFR_HAVE_NORETURN=1 -DMPFR_HAVE_BUILTIN_UNREACHABLE=1 -DMPFR_HAVE_CONSTRUCTOR_ATTR=1 -DHAVE_PTHREAD_PRIO_INHERIT=1 -DHAVE_PTHREAD=1 -DMPFR_HAVE_FESETROUND=1 -DHAVE_DENORMS=1 -DHAVE_DENORMS_FLT=1 -DHAVE_SIGNEDZ=1 -DHAVE_ROUND=1 -DHAVE_TRUNC=1 -DHAVE_FLOOR=1 -DHAVE_CEIL=1 -DHAVE_NEARBYINT=1 -DHAVE_LDOUBLE_IEEE_EXT_LITTLE=1 -DMPFR_USE_THREAD_SAFE=1 -DMPFR_USE_C11_THREAD_SAFE=1 -DMPFR_WANT_DECIMAL_FLOATS=1 -DMPFR_WANT_FLOAT128=1 -DMPFR_USE_STATIC_ASSERT=1 -DHAVE_CLOCK_GETTIME=1 -DHAVE_ATTRIBUTE_MODE=1 -DNPRINTF_J=1 -DNPRINTF_L=1 -DNPRINTF_T=1 -DHAVE___GMPN_SBPI1_DIVAPPR_Q=1 -DHAVE___GMPN_INVERT_LIMB=1 -DHAVE___GMPN_RSBLSH_N=1 -DMPFR_LONG_WITHIN_LIMB=1 -I. -I../../src/src   -IC:/development-personal-builds/gmp-6.1.2/build-1/include  -Wall -Wmissing-prototypes -Wpointer-arith -O2 -pedantic -fomit-frame-pointer -m64 -mtune=k8 -march=k8 -MT exceptions.lo -MD -MP -MF .deps/exceptions.Tpo -c -o exceptions.lo ../../src/src/exceptions.c
  libtool: compile:  gcc -DMPFR_WANT_ASSERT=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 "-DLT_OBJDIR=\\.libs/\" -DHAVE_DOUBLE_IEEE_LITTLE_ENDIAN=1 -DHAVE_LITTLE_ENDIAN=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_LOCALE_H=1 -DHAVE_WCHAR_H=1 -DHAVE_STDARG=1 -DHAVE_SYS_TIME_H=1 -DHAVE_STRUCT_LCONV_DECIMAL_POINT=1 -DHAVE_STRUCT_LCONV_THOUSANDS_SEP=1 -DHAVE_VA_COPY=1 -DHAVE_SETLOCALE=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_SIGNAL=1 -DHAVE_LONG_LONG=1 -DHAVE_INTMAX_T=1 -DMPFR_HAVE_INTMAX_MAX=1 -DMPFR_PRINTF_MAXLM=\"ll\" -DMPFR_HAVE_NORETURN=1 -DMPFR_HAVE_BUILTIN_UNREACHABLE=1 -DMPFR_HAVE_CONSTRUCTOR_ATTR=1 -DHAVE_PTHREAD_PRIO_INHERIT=1 -DHAVE_PTHREAD=1 -DMPFR_HAVE_FESETROUND=1 -DHAVE_DENORMS=1 -DHAVE_DENORMS_FLT=1 -DHAVE_SIGNEDZ=1 -DHAVE_ROUND=1 -DHAVE_TRUNC=1 -DHAVE_FLOOR=1 -DHAVE_CEIL=1 -DHAVE_NEARBYINT=1 -DHAVE_LDOUBLE_IEEE_EXT_LITTLE=1 -DMPFR_USE_THREAD_SAFE=1 -DMPFR_USE_C11_THREAD_SAFE=1 -DMPFR_WANT_DECIMAL_FLOATS=1 -DMPFR_WANT_FLOAT128=1 -DMPFR_USE_STATIC_ASSERT=1 -DHAVE_CLOCK_GETTIME=1 -DHAVE_ATTRIBUTE_MODE=1 -DNPRINTF_J=1 -DNPRINTF_L=1 -DNPRINTF_T=1 -DHAVE___GMPN_SBPI1_DIVAPPR_Q=1 -DHAVE___GMPN_INVERT_LIMB=1 -DHAVE___GMPN_RSBLSH_N=1 -DMPFR_LONG_WITHIN_LIMB=1 -I. -I../../src/src -IC:/development-personal-builds/gmp-6.1.2/build-1/include -Wall -Wmissing-prototypes -Wpointer-arith -O2 -pedantic -fomit-frame-pointer -m64 -mtune=k8 -march=k8 -MT exceptions.lo -MD -MP -MF .deps/exceptions.Tpo -c -o exceptions.lo ../../src/src/exceptions.c"  -DDLL_EXPORT -DPIC -o .libs/exceptions.o
  gcc.exe: fatal error: no input files
  compilation terminated.
  make[2]: *** [Makefile:807: exceptions.lo] Error 1
  make[2]: Leaving directory 'C:/development-personal-builds/mpfr-4.0.1/build-1/src'
  make[1]: *** [Makefile:476: all] Error 2
  make[1]: Leaving directory 'C:/development-personal-builds/mpfr-4.0.1/build-1/src'
  make: *** [Makefile:498: all-recursive] Error 1
  </code></pre>
  
  <p>The command used to execute configure was:</p>
  
  <pre><code>cd build-1
  ../src/configure \
  --prefix=C:/development-personal-builds/mpfr-4.0.1/build-1 \
  --build=x86_64-w64-mingw32 \
  --enable-assert \
  --enable-shared=yes \
  --enable-static=no \
  --with-gmp=C:/development-personal-builds/gmp-6.1.2/build-1
  </code></pre>
  
  <p>The GMP build I supplied was built by me and it passed all 'make check' tests.</p>
  
  <p><strong>Attempts to Fix</strong>
  Following advice given by Mike, I've fed gcc the corrected string via the CC flag, but get a new error as gcc can only write to one file:</p>
  
  <pre><code>CC="--mode=compile gcc -DMPFR_WANT_ASSERT=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_DOUBLE_IEEE_LITTLE_ENDIAN=1 -DHAVE_LITTLE_ENDIAN=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_LOCALE_H=1 -DHAVE_WCHAR_H=1 -DHAVE_STDARG=1 -DHAVE_SYS_TIME_H=1 -DHAVE_STRUCT_LCONV_DECIMAL_POINT=1 -DHAVE_STRUCT_LCONV_THOUSANDS_SEP=1 -DHAVE_VA_COPY=1 -DHAVE_SETLOCALE=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_SIGNAL=1 -DHAVE_LONG_LONG=1 -DHAVE_INTMAX_T=1 -DMPFR_HAVE_INTMAX_MAX=1 -DMPFR_PRINTF_MAXLM=\"ll\" -DMPFR_HAVE_NORETURN=1 -DMPFR_HAVE_BUILTIN_UNREACHABLE=1 -DMPFR_HAVE_CONSTRUCTOR_ATTR=1 -DHAVE_PTHREAD_PRIO_INHERIT=1 -DHAVE_PTHREAD=1 -DMPFR_HAVE_FESETROUND=1 -DHAVE_DENORMS=1 -DHAVE_DENORMS_FLT=1 -DHAVE_SIGNEDZ=1 -DHAVE_ROUND=1 -DHAVE_TRUNC=1 -DHAVE_FLOOR=1 -DHAVE_CEIL=1 -DHAVE_NEARBYINT=1 -DHAVE_LDOUBLE_IEEE_EXT_LITTLE=1 -DMPFR_USE_THREAD_SAFE=1 -DMPFR_USE_C11_THREAD_SAFE=1 -DMPFR_WANT_DECIMAL_FLOATS=1 -DMPFR_WANT_FLOAT128=1 -DMPFR_USE_STATIC_ASSERT=1 -DHAVE_CLOCK_GETTIME=1 -DHAVE_ATTRIBUTE_MODE=1 -DNPRINTF_J=1 -DNPRINTF_L=1 -DNPRINTF_T=1 -DHAVE___GMPN_SBPI1_DIVAPPR_Q=1 -DHAVE___GMPN_INVERT_LIMB=1 -DHAVE___GMPN_RSBLSH_N=1 -DMPFR_LONG_WITHIN_LIMB=1 -I. -I../../src/src -IC:/development-personal-builds/gmp-6.1.2/build-1/include -Wall -Wmissing-prototypes -Wpointer-arith -O2 -pedantic -fomit-frame-pointer -m64 -mtune=k8 -march=k8 -MT exceptions.lo -MD -MP -MF .deps/exceptions.Tpo -c -o exceptions.lo ../../src/src/exceptions.c -DDLL_EXPORT -DPIC -o .libs/exceptions.o"
  </code></pre>
  
  <p>The command is still messed up, as I now get this error:</p>
  
  <pre><code>libtool:   error: you cannot specify '-o' more than once
  </code></pre>
  
  <p>Out of desperation, I've also tried:</p>
  
  <ul>
  <li>Rolling back to MPFR 3.1.6 (the version "recommended" by the MinGW-w64 port here: <a href="https://github.com/emphasis87/libmpfr-msys2-mingw64" rel="nofollow noreferrer">https://github.com/emphasis87/libmpfr-msys2-mingw64</a>);</li>
  <li>Not using a bash script and running configure directly;</li>
  <li>Converting the bash script to ANSI instead of UTF-8;</li>
  <li>Using Cygwin;</li>
  </ul>
  
  <p>Aaargh.</p>