Hello everyone, For GMP build using MSVC got error: =============================================================== make[2]: Entering directory '/c/libGMP-6.1.99-dev/build' /bin/sh ./libtool --tag=CXX --mode=link cl -Zc:wchar_t -FS -nologo -DWIN32 -D_WIN32 -DWIN64 -D_WIN64 -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_DEPRECATE -GR -EHsc -O2 -DNDEBUG -D_NDEBUG -MD -no-undefined -version-info 9:0:5 -o libgmpxx.la -rpath /c/libGMP-6.1.99-dev/build/../MSVC64RH/lib cxx/dummy.lo cxx/isfuns.lo cxx/ismpf.lo cxx/ismpq.lo cxx/ismpz.lo cxx/ismpznw.lo cxx/limits.lo cxx/osdoprnti.lo cxx/osfuns.lo cxx/osmpf.lo cxx/osmpq.lo cxx/osmpz.lo libgmp.la libtool: link: rm -fr .libs/gmpxx.exp libtool: link: /usr/bin/nm -B cxx/.libs/dummy.obj cxx/.libs/isfuns.obj cxx/.libs/ismpf.obj cxx/.libs/ismpq.obj cxx/.libs/ismpz.obj cxx/.libs/ismpznw.obj cxx/.libs/limits.obj cxx/.libs/osdoprnti.obj cxx/.libs/osfuns.obj cxx/.libs/osmpf.obj cxx/.libs/osmpq.obj cxx/.libs/osmpz.obj | sed -n -e 's/^.*[ ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)\{0,1\}$/\1 \2 \2/p' | sed '/ __gnu_lto/d' | /usr/bin/sed 's/.* //' | sort | uniq > .libs/gmpxx.exp libtool: link: if test DEF = "`/usr/bin/sed -n -e 's/^[ ]*//' -e '/^\(;.*\)*$/d' -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' -e q .libs/gmpxx.exp`" ; then cp ".libs/gmpxx.exp" ".libs/gmpxx-4.dll.def"; echo ".libs\\gmpxx-4.dll.def" > ".libs/gmpxx-4.dll.exp"; else /usr/bin/sed -e 's/^/-link -EXPORT:/' < .libs/gmpxx.exp > .libs/gmpxx-4.dll.exp; fi libtool: link: cl -o .libs\\gmpxx-4.dll cxx/.libs/dummy.obj cxx/.libs/isfuns.obj cxx/.libs/ismpf.obj cxx/.libs/ismpq.obj cxx/.libs/ismpz.obj cxx/.libs/ismpznw.obj cxx/.libs/limits.obj cxx/.libs/osdoprnti.obj cxx/.libs/osfuns.obj cxx/.libs/osmpf.obj cxx/.libs/osmpq.obj cxx/.libs/osmpz.obj -FS -O2 ./.libs/gmp.lib "@.libs\\gmpxx-4.dll.exp" -Wl,-DLL,-IMPLIB:".libs\\gmpxx.lib" Microsoft (R) C/C++ Optimizing Compiler Version 19.12.25830.2 for x64 Copyright (C) Microsoft Corporation. All rights reserved.
cl : Command line warning D9035 : option 'o' has been deprecated and will be removed in a future release cl : Command line error D8021 : invalid numeric argument '/Wl,-DLL,-IMPLIB:.libs\gmpxx.lib' make[2]: *** [Makefile:876: libgmpxx.la] Error 2 make[2]: Leaving directory '/c/libGMP-6.1.99-dev/build' make[1]: *** [Makefile:963: all-recursive] Error 1 make[1]: Leaving directory '/c/libGMP-6.1.99-dev/build' make: *** [Makefile:778: all] Error 2 =============================================================== which relate to improperC++ compiler use. Reproduced for: - shared builds using MSVC, not reproduced for: - static builds using MSVC, - shared builds using mingw-w64. Environment: - Windows 10 x64, - MSVC 2017 15.5.0, - Windows SDK 10.0.16299.15, - mingw-w64 x86_64 7.2.0, - MSYS2 x86_64 20170918, - libiconv 1.15. The source of error is missing workaround for CXX compilers via 'compile' script, which enabled in '_AM_PROG_CC_C_O' (http://git.savannah.gnu.org/cgit/automake.git/tree/m4/prog-cc-c-o.m4) subroutine for C compilers only. This results to improper C++ compiler features check during configuration: =============================================================== CC="cl" CXX="cl" ./configure && make <snip> checking whether cl understands -c and -o together... no <snip> checking if /c/libGMP-6.1.99-dev/build/compile cl supports -c -o file.obj... yes <== C compiler features check <snip> checking if cl supports -c -o file.obj... no <== C++ compiler features check =============================================================== and setting improper values to C++ compiler-related variables: =============================================================== CC='/c/libGMP-6.1.99-dev/build/compile cl' CPP='/c/libGMP-6.1.99-dev/build/compile cl -E' <snip> CXX='cl' CXXCPP='cl -E' =============================================================== in 'configure.log' and makefiles. A workaround is to apply patch: =============================================================== # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" + CXX="$am_aux_dir/compile $CXX" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' =============================================================== to file 'm4/prog-cc-c-o.m4' and update GMP build system. Then error not reproduced, and all build tasks finishes successfully. Can this patch be merged to Automake sources? Or it it possible to add '_AM_PROG_CXX_C_O' or other subroutine for C++ compilers check, similar to '_AM_PROG_CC_C_O' for C compilers, which would provide this fix. Best, Alexander