GMP-5.0.1 with Mingw32: incorrect .def filename

Laurent Rineau laurent.rineau__gmp at
Mon Jun 14 18:15:23 CEST 2010


In GMP-5.0.1, the SOMAJOR of libgmp is 10 and the SOMAJOR of libgmpxx is 6.

However, the around line 2211 says:

case $host in
  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
    # By default, build only static.
    # [snip a big comment]
    if test "$enable_shared" = yes; then
      GMP_LDFLAGS="$GMP_LDFLAGS -no-undefined -Wl,--export-all-symbols"
      LIBGMP_LDFLAGS="$LIBGMP_LDFLAGS -Wl,--output-def,.libs/libgmp-3.dll.def"
      LIBGMPXX_LDFLAGS="$LIBGMP_LDFLAGS -Wl,--output-def,.libs/libgmpxx-3.dll.def"


You can see that, on a Mingw platform, the --output-def linker flag is incorrect: the version number in the file name is "3", where is should be either "10" for libgmp or "6" for libgmpxx.

I propose the attached patch: it puts those linker flags into a conditional part of The condition is LIBGMP_DLL, which is turned into an Automake conditional in That way, the setup of 
the flags can use the (Auto)Make variables $(LIBGMP_LT_CURRENT) and $(LIBGMPXX_LT_CURRENT).

I have verified that, with this patch, the library builds with --enable-shared on the platform core2-unknown-linux-gnu, and on the cross-platform x86_64-unknown-linux-gnu with host=i686-pc-mingw32. I hope such 
a patch can be integrated in GMP.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gmp-5.0.1-win.patch
Type: text/x-patch
Size: 13751 bytes
Desc: not available
URL: <>

More information about the gmp-bugs mailing list