Skip Menu |

This queue is for tickets about the Math-GMP CPAN distribution.

Report information
The Basics
Id: 46323
Status: resolved
Priority: 0/
Queue: Math-GMP

People
Owner: greg [...] turnstep.com
Requestors: sisyphus [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 2.05
Fixed in: 2.07



Subject: Makefile.PL fails when gmp library location not found by default.
Hi, On my Win32 box, my gmp library is installed in a location where it's not found by default. In such situations, I expect the following to work: perl Makefile.PL INC="-I/path/to/gmp_header" LIBS="- L/path/to/gmp_library -lgmp" But that will (with Math-GMP-2.05) only work if I apply the attached patch to the Makefile.PL. (Actually, the *minimum* change required to render that command workable is to simply remove the "unlink $output-> {MAKEFILE} if $makefile;" from the Makefile.PL.) Cheers, Rob
Subject: makefile_pl.diff
--- Makefile.PL_orig Sun May 24 21:16:15 2009 +++ Makefile.PL Sun May 24 21:15:52 2009 @@ -11,29 +11,3 @@ 'LIBS' => ['-lgmp'], 'NO_META' => 1, ); - -if (!exists $output->{EXTRALIBS} or $output->{EXTRALIBS} !~ /lgmp/) { - - my $makefile = exists $output->{MAKEFILE} - ? "\nRemoving ($output->{MAKEFILE})\n" : ''; - - warn qq{ -========================================================== - -WARNING! No GMP libraries were detected! - -Please see the INSTALL file. - -=========================================================== - -}; - - ## Do not let make proceed - unlink $output->{MAKEFILE} if $makefile; - - exit 1; -} - -exit 0; - -# end of Makefile.PL
On Sun May 24 07:42:35 2009, SISYPHUS wrote: Show quoted text
> (Actually, the *minimum* change required to > render that command workable is to simply remove the "unlink $output-> > {MAKEFILE} if $makefile;" from the Makefile.PL.)
The problem is that $output->{EXTRALIBS} never matches -lgmp because, on Win32, the gmp link in EXTRALIBS is specified as /full/path_to/libgmp.a (or '.lib', as the case may be). This is probably a better patch: ############################### --- Makefile.PL_orig Sun May 24 21:16:15 2009 +++ Makefile.PL Mon Jun 22 13:19:36 2009 @@ -12,7 +12,7 @@ 'NO_META' => 1, ); -if (!exists $output->{EXTRALIBS} or $output->{EXTRALIBS} !~ /lgmp/) { +if (!exists $output->{EXTRALIBS} or $output->{EXTRALIBS} ! ~ /lgmp|libgmp/) { my $makefile = exists $output->{MAKEFILE} ? "\nRemoving ($output->{MAKEFILE})\n" : ''; ############################### Cheers, Rob
Subject: Makefile.PL fails when gmp library location not found by default. [Patch attached]
Here's a patch that included this bug and #46324 and also makes it tell you it's deleting the Makefile.
diff -u3 -r Math-GMP-2.05\INSTALL Math-GMP-2.05-new\INSTALL --- Math-GMP-2.05\INSTALL Mon Oct 06 08:54:26 2008 +++ Math-GMP-2.05-new\INSTALL Fri Jul 31 09:05:00 2009 @@ -3,7 +3,7 @@ To install this package, you will need a version of the GMP library. You can get it at the homepage of GMP: - http://www.swox.com/gmp/ + http://gmplib.org/ After installing GMP, do the following: Only in Math-GMP-2.05-new: Makefile diff -u3 -r Math-GMP-2.05\Makefile.PL Math-GMP-2.05-new\Makefile.PL --- Math-GMP-2.05\Makefile.PL Mon Oct 06 08:51:10 2008 +++ Math-GMP-2.05-new\Makefile.PL Fri Jul 31 09:07:08 2009 @@ -12,7 +12,7 @@ 'NO_META' => 1, ); -if (!exists $output->{EXTRALIBS} or $output->{EXTRALIBS} !~ /lgmp/) { +if (!exists $output->{EXTRALIBS} or $output->{EXTRALIBS} !~ /lgmp|libgmp/) { my $makefile = exists $output->{MAKEFILE} ? "\nRemoving ($output->{MAKEFILE})\n" : ''; @@ -29,8 +29,10 @@ }; ## Do not let make proceed - unlink $output->{MAKEFILE} if $makefile; - + if ($makefile) { + print $makefile; + unlink $output->{MAKEFILE}; + } exit 1; }
Hi, I would like to second the patch proposed by CSJEWELL. Could you please consider applying it and releasing patched version? The main problem is that ExtUtils::MakeMaker generates Makefile for Win32 slightly differently. The EXTRALIBS item does not look like: EXTRALIBS = -lgmp -lotherlib ... but like this: EXTRALIBS = d:/path/to/libgmp.a d:/path/to/libotherlib.a ... So checking for substring "lgmp" will obviously fail. Let me know if I can somehow help you with fixing this issue. -- kmx
Applied (changed the regex to simply "gmp").