title: ./configure cannot not find a working compiler while building gmp library with MSYS2
body: <p>I'm trying to build gmp-6.1.2 on Windows using MSYS2 with <code>./configure --enable-cxx</code> command. I get the following error:</p>
  
  <blockquote>
    <p>configure: error: could not find a working compiler, see config.log for details</p>
  </blockquote>
  
  <p>Below is the content of <code>config.log</code></p>
  
  <pre><code>This file contains any messages produced by compilers while
  running configure, to aid debugging if configure makes a mistake.
  
  It was created by GNU MP configure 6.1.2, which was
  generated by GNU Autoconf 2.69.  Invocation command line was
  
    $ ./configure --enable-cxx
  
  ## --------- ##
  ## Platform. ##
  ## --------- ##
  
  hostname = computer-name
  uname -m = x86_64
  uname -r = 2.11.1(0.329/5/3)
  uname -s = MINGW64_NT-10.0
  uname -v = 2018-09-10 14:19
  
  /usr/bin/uname -p = unknown
  /bin/uname -X     = unknown
  
  /bin/arch              = x86_64
  /usr/bin/arch -k       = unknown
  /usr/convex/getsysinfo = unknown
  /usr/bin/hostinfo      = unknown
  /bin/machine           = unknown
  /usr/bin/oslevel       = unknown
  /bin/universe          = unknown
  
  PATH: /mingw64/bin
  PATH: /usr/local/bin
  PATH: /usr/bin
  PATH: /bin
  PATH: /c/Windows/System32
  PATH: /c/Windows
  PATH: /c/Windows/System32/Wbem
  PATH: /c/Windows/System32/WindowsPowerShell/v1.0/
  PATH: /usr/bin/site_perl
  PATH: /usr/bin/vendor_perl
  PATH: /usr/bin/core_perl
  
  
  ## ----------- ##
  ## Core tests. ##
  ## ----------- ##
  
  configure:2885: loading site script /mingw64/etc/config.site
  | # This file is in public domain.
  | # Original author: Karlson2k (Evgeny Grin)
  | # Written for MSys2/MinGW64 to help running 'configure' scripts
  | 
  | # Defaults for MinGW64-targeted programs
  | 
  | # Set proper selfname on bash and fallback to default name on other shells
  | test -n "${BASH_SOURCE}" 2&gt;/dev/null &amp;&amp; config_site_me="${BASH_SOURCE[0]##*/}" || config_site_me=config.site
  | 
  | # Set default 'host' to speedup configure
  | if test -z "$build_alias"; then
  |   build_alias="${MSYSTEM_CHOST-x86_64-w64-mingw32}" &amp;&amp; \
  |     $as_echo "$config_site_me:${as_lineno-$LINENO}: default build_alias set to $build_alias" &gt;&amp;5 
  | fi
  | 
  | # Set default 'prefix' to "/mingw64"
  | if ( test -z "$prefix" || test "x$prefix" = "xNONE" ) &amp;&amp; \
  |    ( test -z "$exec_prefix" || test "x$exec_prefix" = "xNONE" ); then
  |   prefix="${MSYSTEM_PREFIX-/mingw64}" &amp;&amp; \
  |     $as_echo "$config_site_me:${as_lineno-$LINENO}: default prefix set to $prefix" &gt;&amp;5
  | fi
  config.site:13: default build_alias set to x86_64-w64-mingw32
  config.site:20: default prefix set to /mingw64
  configure:3055: checking build system type
  configure:3069: result: x86_64-w64-mingw32
  configure:3089: checking host system type
  configure:3102: result: x86_64-w64-mingw32
  configure:3139: checking for a BSD-compatible install
  configure:3207: result: /usr/bin/install -c
  configure:3218: checking whether build environment is sane
  configure:3273: result: yes
  configure:3424: checking for a thread-safe mkdir -p
  configure:3463: result: /usr/bin/mkdir -p
  configure:3470: checking for gawk
  configure:3486: found /usr/bin/gawk
  configure:3497: result: gawk
  configure:3508: checking whether make sets $(MAKE)
  configure:3534: result: no
  configure:3559: checking whether make supports nested variables
  configure:3576: result: no
  configure:3705: checking whether to enable maintainer-specific portions of Makefiles
  configure:3714: result: no
  User:
  ABI=
  CC=
  CFLAGS=(unset)
  CPPFLAGS=(unset)
  MPN_PATH=
  GMP:
  abilist=64 x32 32
  cclist=gcc icc cc
  configure:5801: gcc 2&gt;&amp;1 | grep xlc &gt;/dev/null
  configure:5804: $? = 1
  configure:5858: checking compiler gcc -O2 -pedantic -fomit-frame-pointer -m64 
  Test compile: 
  configure:5872: gcc -O2 -pedantic -fomit-frame-pointer -m64  conftest.c &gt;&amp;5
  ./configure: line 5873: gcc: command not found
  configure:5875: $? = 127
  failed program was:
  
  int main () { return 0; }
  configure:6962: result: no
  configure:5779: cc -c conftest.c &gt;&amp;5
  ./configure: line 5780: cc: command not found
  configure:5782: $? = 127
  configure:5801: cc 2&gt;&amp;1 | grep xlc &gt;/dev/null
  configure:5804: $? = 1
  configure:5858: checking compiler cc -O 
  Test compile: 
  configure:5872: cc -O  conftest.c &gt;&amp;5
  ./configure: line 5873: cc: command not found
  configure:5875: $? = 127
  failed program was:
  
  int main () { return 0; }
  configure:6962: result: no
  configure:5801: gcc 2&gt;&amp;1 | grep xlc &gt;/dev/null
  configure:5804: $? = 1
  configure:5858: checking compiler gcc -O2 -pedantic -fomit-frame-pointer -mx32 
  Test compile: 
  configure:5872: gcc -O2 -pedantic -fomit-frame-pointer -mx32  conftest.c &gt;&amp;5
  ./configure: line 5873: gcc: command not found
  configure:5875: $? = 127
  failed program was:
  
  int main () { return 0; }
  configure:6962: result: no
  configure:5779: cc -c conftest.c &gt;&amp;5
  ./configure: line 5780: cc: command not found
  configure:5782: $? = 127
  configure:5801: cc 2&gt;&amp;1 | grep xlc &gt;/dev/null
  configure:5804: $? = 1
  configure:5858: checking compiler cc  
  Test compile: 
  configure:5872: cc   conftest.c &gt;&amp;5
  ./configure: line 5873: cc: command not found
  configure:5875: $? = 127
  failed program was:
  
  int main () { return 0; }
  configure:6962: result: no
  configure:5801: gcc 2&gt;&amp;1 | grep xlc &gt;/dev/null
  configure:5804: $? = 1
  configure:5858: checking compiler gcc -m32 -O2 -pedantic -fomit-frame-pointer 
  Test compile: 
  configure:5872: gcc -m32 -O2 -pedantic -fomit-frame-pointer  conftest.c &gt;&amp;5
  ./configure: line 5873: gcc: command not found
  configure:5875: $? = 127
  failed program was:
  
  int main () { return 0; }
  configure:6962: result: no
  configure:5858: checking compiler gcc -O2 -pedantic -fomit-frame-pointer 
  Test compile: 
  configure:5872: gcc -O2 -pedantic -fomit-frame-pointer  conftest.c &gt;&amp;5
  ./configure: line 5873: gcc: command not found
  configure:5875: $? = 127
  failed program was:
  
  int main () { return 0; }
  configure:6962: result: no
  configure:5779: icc -c conftest.c &gt;&amp;5
  ./configure: line 5780: icc: command not found
  configure:5782: $? = 127
  configure:5801: icc 2&gt;&amp;1 | grep xlc &gt;/dev/null
  configure:5804: $? = 1
  configure:5858: checking compiler icc -no-gcc 
  Test compile: 
  configure:5872: icc -no-gcc  conftest.c &gt;&amp;5
  ./configure: line 5873: icc: command not found
  configure:5875: $? = 127
  failed program was:
  
  int main () { return 0; }
  configure:6962: result: no
  configure:5779: cc -c conftest.c &gt;&amp;5
  ./configure: line 5780: cc: command not found
  configure:5782: $? = 127
  configure:5801: cc 2&gt;&amp;1 | grep xlc &gt;/dev/null
  configure:5804: $? = 1
  configure:5858: checking compiler cc -O 
  Test compile: 
  configure:5872: cc -O  conftest.c &gt;&amp;5
  ./configure: line 5873: cc: command not found
  configure:5875: $? = 127
  failed program was:
  
  int main () { return 0; }
  configure:6962: result: no
  configure:7200: error: could not find a working compiler, see config.log for details
  
  ## ---------------- ##
  ## Cache variables. ##
  ## ---------------- ##
  
  ac_cv_build=x86_64-w64-mingw32
  ac_cv_env_ABI_set=
  ac_cv_env_ABI_value=
  ac_cv_env_CCC_set=
  ac_cv_env_CCC_value=
  ac_cv_env_CC_FOR_BUILD_set=
  ac_cv_env_CC_FOR_BUILD_value=
  ac_cv_env_CC_set=
  ac_cv_env_CC_value=
  ac_cv_env_CFLAGS_set=
  ac_cv_env_CFLAGS_value=
  ac_cv_env_CPPFLAGS_set=
  ac_cv_env_CPPFLAGS_value=
  ac_cv_env_CPP_FOR_BUILD_set=
  ac_cv_env_CPP_FOR_BUILD_value=
  ac_cv_env_CPP_set=
  ac_cv_env_CPP_value=
  ac_cv_env_CXXCPP_set=
  ac_cv_env_CXXCPP_value=
  ac_cv_env_CXXFLAGS_set=
  ac_cv_env_CXXFLAGS_value=
  ac_cv_env_CXX_set=
  ac_cv_env_CXX_value=
  ac_cv_env_LDFLAGS_set=
  ac_cv_env_LDFLAGS_value=
  ac_cv_env_LIBS_set=
  ac_cv_env_LIBS_value=
  ac_cv_env_LT_SYS_LIBRARY_PATH_set=
  ac_cv_env_LT_SYS_LIBRARY_PATH_value=
  ac_cv_env_M4_set=
  ac_cv_env_M4_value=
  ac_cv_env_YACC_set=
  ac_cv_env_YACC_value=
  ac_cv_env_YFLAGS_set=
  ac_cv_env_YFLAGS_value=
  ac_cv_env_build_alias_set=
  ac_cv_env_build_alias_value=
  ac_cv_env_host_alias_set=
  ac_cv_env_host_alias_value=
  ac_cv_env_target_alias_set=
  ac_cv_env_target_alias_value=
  ac_cv_host=x86_64-w64-mingw32
  ac_cv_path_install='/usr/bin/install -c'
  ac_cv_path_mkdir=/usr/bin/mkdir
  ac_cv_prog_AWK=gawk
  ac_cv_prog_make_make_set=no
  am_cv_make_support_nested_variables=no
  
  ## ----------------- ##
  ## Output variables. ##
  ## ----------------- ##
  
  ABI=''
  ACLOCAL='${SHELL} /c/Users/x/Desktop/gmp-6.1.2/missing aclocal-1.15'
  AMTAR='$${TAR-tar}'
  AM_BACKSLASH='\'
  AM_DEFAULT_V='1'
  AM_DEFAULT_VERBOSITY='1'
  AM_V='1'
  AR=''
  AS=''
  ASMFLAGS=''
  AUTOCONF='${SHELL} /c/Users/x/Desktop/gmp-6.1.2/missing autoconf'
  AUTOHEADER='${SHELL} /c/Users/x/Desktop/gmp-6.1.2/missing autoheader'
  AUTOMAKE='${SHELL} /c/Users/x/Desktop/gmp-6.1.2/missing automake-1.15'
  AWK='gawk'
  CALLING_CONVENTIONS_OBJS='x86call.lo x86check$U.lo'
  CC=''
  CCAS=''
  CC_FOR_BUILD=''
  CFLAGS=''
  CPP=''
  CPPFLAGS=''
  CPP_FOR_BUILD=''
  CXX=''
  CXXCPP=''
  CXXFLAGS=''
  CYGPATH_W='cygpath -w'
  DEFN_LONG_LONG_LIMB=''
  DEFS=''
  DLLTOOL=''
  DSYMUTIL=''
  DUMPBIN=''
  ECHO_C=''
  ECHO_N='-n'
  ECHO_T=''
  EGREP=''
  ENABLE_STATIC_FALSE=''
  ENABLE_STATIC_TRUE=''
  EXEEXT=''
  EXEEXT_FOR_BUILD=''
  FGREP=''
  GMP_LDFLAGS=''
  GMP_LIMB_BITS=''
  GMP_NAIL_BITS='0'
  GREP=''
  HAVE_CLOCK_01=''
  HAVE_CPUTIME_01=''
  HAVE_GETRUSAGE_01=''
  HAVE_GETTIMEOFDAY_01=''
  HAVE_HOST_CPU_FAMILY_power='0'
  HAVE_HOST_CPU_FAMILY_powerpc='0'
  HAVE_SIGACTION_01=''
  HAVE_SIGALTSTACK_01=''
  HAVE_SIGSTACK_01=''
  HAVE_STACK_T_01=''
  HAVE_SYS_RESOURCE_H_01=''
  INSTALL_DATA='${INSTALL} -m 644'
  INSTALL_PROGRAM='${INSTALL}'
  INSTALL_SCRIPT='${INSTALL}'
  INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
  LD=''
  LDFLAGS=''
  LEX=''
  LEXLIB=''
  LEX_OUTPUT_ROOT=''
  LIBCURSES=''
  LIBGMPXX_LDFLAGS=''
  LIBGMP_DLL=''
  LIBGMP_LDFLAGS=''
  LIBM=''
  LIBM_FOR_BUILD=''
  LIBOBJS=''
  LIBREADLINE=''
  LIBS=''
  LIBTOOL=''
  LIPO=''
  LN_S=''
  LTLIBOBJS=''
  LT_SYS_LIBRARY_PATH=''
  M4=''
  MAINT='#'
  MAINTAINER_MODE_FALSE=''
  MAINTAINER_MODE_TRUE='#'
  MAKEINFO='${SHELL} /c/Users/x/Desktop/gmp-6.1.2/missing makeinfo'
  MANIFEST_TOOL=''
  MKDIR_P='/usr/bin/mkdir -p'
  NM=''
  NMEDIT=''
  OBJDUMP=''
  OBJEXT=''
  OTOOL64=''
  OTOOL=''
  PACKAGE='gmp'
  PACKAGE_BUGREPORT='gmp-bugs@gmplib.org, see https://gmplib.org/manual/Reporting-Bugs.html'
  PACKAGE_NAME='GNU MP'
  PACKAGE_STRING='GNU MP 6.1.2'
  PACKAGE_TARNAME='gmp'
  PACKAGE_URL='http://www.gnu.org/software/gmp/'
  PACKAGE_VERSION='6.1.2'
  PATH_SEPARATOR=':'
  RANLIB=''
  SED=''
  SET_MAKE='MAKE=make'
  SHELL='/bin/sh'
  SPEED_CYCLECOUNTER_OBJ='pentium.lo'
  STRIP=''
  TAL_OBJECT=''
  TUNE_LIBS=''
  TUNE_SQR_OBJ=''
  U_FOR_BUILD=''
  VERSION='6.1.2'
  WANT_CXX_FALSE=''
  WANT_CXX_TRUE=''
  WITH_READLINE_01=''
  YACC=''
  YFLAGS=''
  ac_ct_AR=''
  ac_ct_CC=''
  ac_ct_CXX=''
  ac_ct_DUMPBIN=''
  am__EXEEXT_FALSE=''
  am__EXEEXT_TRUE=''
  am__isrc=''
  am__leading_dot='.'
  am__tar='$${TAR-tar} chof - "$$tardir"'
  am__untar='$${TAR-tar} xf -'
  bindir='${exec_prefix}/bin'
  build='x86_64-w64-mingw32'
  build_alias='x86_64-w64-mingw32'
  build_cpu='x86_64'
  build_os='mingw32'
  build_vendor='w64'
  datadir='${datarootdir}'
  datarootdir='${prefix}/share'
  docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
  dvidir='${docdir}'
  exec_prefix='NONE'
  gmp_srclinks=''
  host='x86_64-w64-mingw32'
  host_alias=''
  host_cpu='x86_64'
  host_os='mingw32'
  host_vendor='w64'
  htmldir='${docdir}'
  includedir='${prefix}/include'
  infodir='${datarootdir}/info'
  install_sh='${SHELL} /c/Users/x/Desktop/gmp-6.1.2/install-sh'
  libdir='${exec_prefix}/lib'
  libexecdir='${exec_prefix}/libexec'
  localedir='${datarootdir}/locale'
  localstatedir='${prefix}/var'
  mandir='${datarootdir}/man'
  mkdir_p='$(MKDIR_P)'
  mpn_objects=''
  mpn_objs_in_libgmp=''
  oldincludedir='/usr/include'
  pdfdir='${docdir}'
  prefix='/mingw64'
  program_transform_name='s,x,x,'
  psdir='${docdir}'
  sbindir='${exec_prefix}/sbin'
  sharedstatedir='${prefix}/com'
  sysconfdir='${prefix}/etc'
  target_alias=''
  
  ## ----------- ##
  ## confdefs.h. ##
  ## ----------- ##
  
  /* confdefs.h */
  #define PACKAGE_NAME "GNU MP"
  #define PACKAGE_TARNAME "gmp"
  #define PACKAGE_VERSION "6.1.2"
  #define PACKAGE_STRING "GNU MP 6.1.2"
  #define PACKAGE_BUGREPORT "gmp-bugs@gmplib.org, see https://gmplib.org/manual/Reporting-Bugs.html"
  #define PACKAGE_URL "http://www.gnu.org/software/gmp/"
  #define PACKAGE "gmp"
  #define VERSION "6.1.2"
  #define WANT_FFT 1
  #define HAVE_HOST_CPU_x86_64 1
  #define HOST_DOS64 1
  
  configure: exit 1
  </code></pre>
  
  <p>Definitely, <code>$CC</code> is empty. I have gcc installed with MinGW so I tried to assign <code>/c/MinGW/bin/gcc.exe</code> to <code>$CC</code> but that didn't work either.</p>
  
  <p>I know there are similar questions but none of those solutions solves my problem.</p>