GNU bug report logs - #30128
MSVC: 'invalid numeric argument '/Wl,-DLL,-IMPLIB:.libs...' error for shared GMP builds on Windows

Previous Next

Package: automake;

Reported by: sav_ix <at> ukr.net

Date: Mon, 15 Jan 2018 16:17:04 UTC

Severity: normal

To reply to this bug, email your comments to 30128 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-automake <at> gnu.org:
bug#30128; Package automake. (Mon, 15 Jan 2018 16:17:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to sav_ix <at> ukr.net:
New bug report received and forwarded. Copy sent to bug-automake <at> gnu.org. (Mon, 15 Jan 2018 16:17:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: sav_ix <at> ukr.net
To: bug-automake <at> gnu.org
Subject: MSVC: 'invalid numeric argument '/Wl,-DLL,-IMPLIB:.libs...' error
 for shared GMP builds on Windows
Date: Mon, 15 Jan 2018 16:32:25 +0200
[Message part 1 (text/plain, inline)]
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

[Message part 2 (text/html, inline)]

Information forwarded to bug-automake <at> gnu.org:
bug#30128; Package automake. (Wed, 17 Jan 2018 22:46:01 GMT) Full text and rfc822 format available.

Message #8 received at 30128 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Lirzin <mthl <at> gnu.org>
To: sav_ix <at> ukr.net
Cc: 30128 <at> debbugs.gnu.org
Subject: Re: bug#30128: MSVC: 'invalid numeric argument '/Wl, -DLL,
 -IMPLIB:.libs...' error for shared GMP builds on Windows
Date: Wed, 17 Jan 2018 23:45:04 +0100
Hello Alexander,

sav_ix <at> ukr.net writes:

> 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
>
> checking if /c/libGMP-6.1.99-dev/build/compile cl supports -c -o file.obj... yes <== C compiler features check
>
> checking if cl supports -c -o file.obj... no ===============================================================
>
> 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.

It will indeed be nice to fix the issue you face, however I guess this
should not be done not on Automake side, because AM_PROG_CC_C_O is
obsolescent [1].

I have took a quick look a GMP “configure.ac” and it seems that they
have an option ’--enable-cxx’ which triggers the use of the AC_PROG_CXX
macro which I guess should set things properly (I am not an Autoconf
expert), If not this is either an issue with GMP configuration or with
With AC_PROG_CXX implementation.

Could you investigate with the ’--enable-cxx’ option?

Thanks for the report.

[1] https://www.gnu.org/software/automake/manual/html_node/Public-Macros.html#index-AM_005fPROG_005fCC_005fC_005fO

-- 
Mathieu Lirzin
GPG: F2A3 8D7E EB2B 6640 5761  070D 0ADE E100 9460 4D37




Information forwarded to bug-automake <at> gnu.org:
bug#30128; Package automake. (Sun, 21 Jan 2018 17:27:02 GMT) Full text and rfc822 format available.

Message #11 received at 30128 <at> debbugs.gnu.org (full text, mbox):

From: sav_ix <at> ukr.net
To: Mathieu Lirzin <mthl <at> gnu.org>
Cc: 30128 <at> debbugs.gnu.org
Subject: Re[2]: bug#30128: MSVC: 'invalid numeric argument
 '/Wl,-DLL,-IMPLIB:.libs...' error for shared GMP builds on Windows
Date: Sun, 21 Jan 2018 15:11:03 +0200
[Message part 1 (text/plain, inline)]
  

--- Оригінальне повідомлення ---
Від кого: "Mathieu Lirzin" <mthl <at> gnu.org>
Дата: 18 січня 2018, 00:45:20


> I have took a quick look a GMP “configure.ac” and it seems that they
> have an option ’--enable-cxx’ which triggers the use of the AC_PROG_CXX
> macro which I guess should set things properly (I am not an Autoconf
> expert), If not this is either an issue with GMP configuration or with
> With AC_PROG_CXX implementation.
> 
> Could you investigate with the ’--enable-cxx’ option?

Me run GMP builds with '--enable-cxx' flag. But it has no effect on this issue, presumably since it doesn't call any subroutine, which enable 'compile' use for MSVC explicitly or as a side effect.

Taking into account your tips, considered to replace 'CC="cl" CXX="cl"' with 'CC="$PWD/compile cl" CXX="$PWD/compile cl"' options in GMP build commands. This fixed this issue and ensures no problems, when '_AM_PROG_CC_C_O' would be removed from Automake.

Thus I assume this issue could be closed. Thank you for help.


Best,

Alexander

[Message part 2 (text/html, inline)]

Information forwarded to bug-automake <at> gnu.org:
bug#30128; Package automake. (Tue, 23 Jan 2018 14:32:01 GMT) Full text and rfc822 format available.

Message #14 received at 30128 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Lirzin <mthl <at> gnu.org>
To: sav_ix <at> ukr.net
Cc: 30128 <at> debbugs.gnu.org
Subject: Re: bug#30128: Re[2]: bug#30128: MSVC: 'invalid numeric argument '/Wl, -DLL,
 -IMPLIB:.libs...' error for shared GMP builds on Windows
Date: Tue, 23 Jan 2018 15:31:01 +0100
sav_ix <at> ukr.net writes:

> --- Оригінальне повідомлення ---
> Від кого: "Mathieu Lirzin" <mthl <at> gnu.org>
> Дата: 18 січня 2018, 00:45:20
>
>  > I have took a quick look a GMP “configure.ac” and it seems that they
>> have an option ’--enable-cxx’ which triggers the use of the AC_PROG_CXX
>> macro which I guess should set things properly (I am not an Autoconf
>> expert), If not this is either an issue with GMP configuration or with
>> With AC_PROG_CXX implementation.
>> 
>> Could you investigate with the ’--enable-cxx’ option?
>
> Me run GMP builds with '--enable-cxx' flag. But it has no effect on
> this issue, presumably since it doesn't call any subroutine, which
> enable 'compile' use for MSVC explicitly or as a side effect.
>
> Taking into account your tips, considered to replace 'CC="cl"
> CXX="cl"' with 'CC="$PWD/compile cl" CXX="$PWD/compile cl"' options in
> GMP build commands. This fixed this issue and ensures no problems,
> when '_AM_PROG_CC_C_O' would be removed from Automake.
>
> Thus I assume this issue could be closed. Thank you for help.

No, it should not be closed.  When speaking of obsolescence I was
confusing _AM_PROG_CC_C_O and AM_PROG_CC_C_O macros.

_AM_PROG_CC_C_O is used to rewrite AC_PROG_CC:

--8<---------------cut here---------------start------------->8---
dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O.
m4_define([AC_PROG_CC],
m4_defn([AC_PROG_CC])
[_AM_PROG_CC_C_O
])
--8<---------------cut here---------------end--------------->8---

What needs to be done is to similarly redefine AC_PROG_CXX to use the
‘compile’ wrapper script for icl and others C++ compiler which do not
understand ‘-c -o’.

-- 
Mathieu Lirzin
GPG: F2A3 8D7E EB2B 6640 5761  070D 0ADE E100 9460 4D37




This bug report was last modified 7 years and 145 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.