Skip Menu |

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

Report information
The Basics
Id: 78286
Status: rejected
Priority: 0/
Queue: Math-GSL

People
Owner: Nobody in particular
Requestors: sisyphus [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.27
Fixed in: (no value)



Subject: 0.27 build process is a broken mess
Attached is a patch to Build.PL that fixes part of the problem. Why on earth we want to to prefix $ENV{PKG_CONFIG_PATH} with $guess is beyond me ... but I've left that as is. Does $ENV{PKG_CONFIG_PATH} really just ignore embedded newlines on *nix ? ($guess ends with a newline, which my patch then removes.) Anyway, with that patch in place, I can successfully run 'perl Build.PL' on windows. The real annoyance is that whenever I run 'perl build clean' it cleans up a large number of the source files. So I have to have a special backup tarball that I can extract to replace them. (I can't just extract the Math-GSL-0.27 source again, because that will overwrite my corrected Build.PL, and any other changes I've made.) As a result (mainly) of that tedium, I got sick of trying to work out the reason that, in inc/GSLBuilder.pm's get_binding_version(), $self->{properties}->{current_version} is always empty (is it because Build.PL's $gv never gets set for me?), so I just hard coded it to 1.15, and everything went ok. At least, I was then able to build for 32-bit perl-5.16.0. Of course, when my build script moved on to try to build for the next (different) version of perl, it failed because the 'perl build clean' at the end of the 5.16.0 build had removed vital pieces of the Math-GSL-0.27 source. Cheers, Rob
Subject: diff.txt
--- Build.PL_orig 2012-07-10 10:59:56 +1000 +++ Build.PL 2012-07-10 12:01:20 +1000 @@ -280,9 +280,12 @@ $ENV{PKG_CONFIG_PATH} ||= ''; # TODO: What about windows and darwin? + # One thing we could do is to (portably) use the correct path separator. + my $ps = $Config{path_sep}; my $guess =<<CARGOCULT; -/usr/pkgconfig:/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/pkgconfig:/usr/libdata/pkgconfig:/usr/local/libdata/pkgconfig:/opt/pkgconfig: +/usr/pkgconfig${ps}/usr/lib/pkgconfig${ps}/usr/local/lib/pkgconfig${ps}/usr/local/pkgconfig${ps}/usr/libdata/pkgconfig${ps}/usr/local/libdata/pkgconfig${ps}/opt/pkgconfig${ps} CARGOCULT + chomp($guess); # We don't want any newlines in $ENV{PKG_CONFIG_PATH} $ENV{PKG_CONFIG_PATH} = $guess . $ENV{PKG_CONFIG_PATH}; }
Part of the problem is that, on MS Windows, the gsl-config file that gets built during the building of the gsl library is not executable in the cmd.exe shell. It's executable in the msys shell (which is the shell in which the gsl library was built) but it's not executable in the cmd.exe shell (which is the shell in which we build Math::GSL). No problems with gsl.pc and ExtUtils::PkgConfig in the cmd.exe but, unfortunately that part is currently broken in Math-GSL-0.27 (as mentioned in my first post to this report). Is EU::PkgConfig now relegated to a fallback - for those cases where gsl-config has failed ? If so, $current_version needs to be set to $pkgcfg_ver in Build.PL - otherwise that fallback doesn't work unless the user also hard codes the value into inc/GSLBuilder.pm (as I originally did). Eventually I built (by hand) a gsl-config.exe that was executable in the cmd.exe shell, and gave the right returns for 'gsl-config --version', 'gsl-config --prefix', 'gsl-config --cflags' and 'gsl-config --libs'. That enabled things to work much better and I no longer had to hard code $_[0]->{properties}->{current_version} to 1.15 in inc/GSLBuilder.pm. However, 'build clean' poses a problem in the things that it cleans up. One thing it does is clean up is the pm directory - though I don't think that's ever a problem (for reasons that elude me). The real problem happens when 'build clean' decides to clobber the c files in the xs folder - which happened only for those of my versions of perl that were running Module-Build-0.3901. (Note that perl-5.16 ships with Module-Build-0.3901.) In short, attached is a revised patch to the original Build.PL that shipped with Math-GSL-0.27. It differs from the first patch only in that it additionally sets $current_version to $pkgcfg_ver when gsl-config has failed. It doesn't attend to the clean-up problem that arises with Module-Build-0.3901. And I don't think it even comes into play if gsl-config has done the job. Cheers, Rob
Subject: Build.PL.diff
--- Build.PL_orig 2012-07-10 10:59:56 +1000 +++ Build.PL 2012-07-16 21:09:13 +1000 @@ -156,7 +156,12 @@ my %gsl_pkgcfg = ExtUtils::PkgConfig->find ('gsl'); my $pkgcfg_ver = $gsl_pkgcfg{'modversion'}; -warn "pkgconfig version $pkgcfg_ver != gsl-config $gv possible misconfiguration" if $pkgcfg_ver ne $gv; +if($gv) { + warn "pkgconfig version $pkgcfg_ver != gsl-config $gv possible misconfiguration" if $pkgcfg_ver ne $gv; +} +else { + $current_version = $pkgcfg_ver; +} my $ccflags = $gsl_pkgcfg{cflags}; @@ -280,9 +285,12 @@ $ENV{PKG_CONFIG_PATH} ||= ''; # TODO: What about windows and darwin? + # One thing we could do is to (portably) use the correct path separator. + my $ps = $Config{path_sep}; my $guess =<<CARGOCULT; -/usr/pkgconfig:/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/pkgconfig:/usr/libdata/pkgconfig:/usr/local/libdata/pkgconfig:/opt/pkgconfig: +/usr/pkgconfig${ps}/usr/lib/pkgconfig${ps}/usr/local/lib/pkgconfig${ps}/usr/local/pkgconfig${ps}/usr/libdata/pkgconfig${ps}/usr/local/libdata/pkgconfig${ps}/opt/pkgconfig${ps} CARGOCULT + chomp($guess); # We don't want any newlines in $ENV{PKG_CONFIG_PATH} $ENV{PKG_CONFIG_PATH} = $guess . $ENV{PKG_CONFIG_PATH}; }
On Mon Jul 16 07:28:49 2012, SISYPHUS wrote: Show quoted text
> The real problem happens when 'build clean' decides to clobber the c > files in the xs folder - which happened only for those of my versions of > perl that were running Module-Build-0.3901. (Note that perl-5.16 ships > with Module-Build-0.3901.)
Hmmm ... On closer investigation, I think it might be perl-5.16.0, and not M::B-0.3901 that's doing this. I have M::B-0.3901 on my perl-5.10.0 (x86 and x64) and perl-5.16.0 (x86, x86-64int and x64)builds, but the 5.10.0 builds don't clobber the c files in the xs directory during 'build clean'. That's happening for the 5.16.0 builds only. Cheers, Rob
On Mon Jul 09 22:51:06 2012, SISYPHUS wrote: Show quoted text
> Attached is a patch to Build.PL that fixes part of the problem. > > Why on earth we want to to prefix $ENV{PKG_CONFIG_PATH} with $guess is > beyond me ... but I've left that as is. >
If guess is really needed, it should go *after* $ENV{PKG_CONFIG_PATH}, not before. Currently this "breaks" my builds because I've installed a newer version of GSL than the system one, but the system one still gets linked in (After the chomping of course..., which just plain breaks the build)
On Fri Mar 22 12:00:25 2013, DJERIUS wrote: Show quoted text
> On Mon Jul 09 22:51:06 2012, SISYPHUS wrote:
> > Attached is a patch to Build.PL that fixes part of the problem. > > > > Why on earth we want to to prefix $ENV{PKG_CONFIG_PATH} with $guess
> is
> > beyond me ... but I've left that as is. > >
> > If guess is really needed, it should go *after* $ENV{PKG_CONFIG_PATH}, > not before. Currently this "breaks" my builds because I've > installed a newer version of GSL than the system one, but the > system one still gets linked in (After the chomping of course..., > which just plain breaks the build)
I meant of course: After the chomping of course... without which the build is just plain broken)
On Fri Mar 22 12:02:00 2013, DJERIUS wrote: Show quoted text
> On Fri Mar 22 12:00:25 2013, DJERIUS wrote:
> > On Mon Jul 09 22:51:06 2012, SISYPHUS wrote:
> > > Attached is a patch to Build.PL that fixes part of the problem. > > > > > > Why on earth we want to to prefix $ENV{PKG_CONFIG_PATH} with
> $guess
> > is
> > > beyond me ... but I've left that as is. > > >
> > > > If guess is really needed, it should go *after*
> $ENV{PKG_CONFIG_PATH},
> > not before. Currently this "breaks" my builds because I've > > installed a newer version of GSL than the system one, but the > > system one still gets linked in (After the chomping of course..., > > which just plain breaks the build)
> > I meant of course: > > After the chomping of course... without which the build is just plain > broken)
Attached is my version of a fix for the gsl-config/pkg-config confusion. It first tries pkg-config, then gsl-config. There's a possibility of confusion if the ordering of your PATH gets you the version of gsl-config that differs from what's in the PKG_CONFIG_PATH. I believe it's safer to just use pkg-config (with a fall back if it's not found there). The patch also includes the chomping from sisyphus.
Subject: Math-GSL-0.27.patch
# This is a patch for Math-GSL-0.27.orig to update it to Math-GSL-0.27 # # To apply this patch: # STEP 1: Chdir to the source directory. # STEP 2: Run the 'applypatch' program with this patch file as input. # # If you do not have 'applypatch', it is part of the 'makepatch' package # that you can fetch from the Comprehensive Perl Archive Network: # http://www.perl.com/CPAN/authors/Johan_Vromans/makepatch-x.y.tar.gz # In the above URL, 'x' should be 2 or higher. # # To apply this patch without the use of 'applypatch': # STEP 1: Chdir to the source directory. # STEP 2: Run the 'patch' program with this file as input. # #### End of Preamble #### #### Patch data follows #### diff -c 'Math-GSL-0.27.orig/Build.PL' 'Math-GSL-0.27/Build.PL' Index: ./Build.PL *** ./Build.PL Sun Jul 8 23:24:47 2012 --- ./Build.PL Fri Mar 22 16:19:09 2013 *************** *** 104,113 **** } print "Checking for GSL..\n"; ! chomp(my $gv = qx{gsl-config --version}); ! chomp(my $gsl_prefix = qx{gsl-config --prefix}); ! chomp(my $gsl_cflags = qx{gsl-config --cflags}); ! chomp(my $gsl_libs = qx{gsl-config --libs}); my $MIN_GSL_VERSION = "1.11"; --- 104,122 ---- } print "Checking for GSL..\n"; ! # gsl provides both gsl-config and pkg-config's gsl.pc. Try the ! # latter, then the former ! ! ! my %gsl; ! ( %gsl = find_via_pkg_config()) or ( %gsl = find_via_gsl_config()); ! ! die( q[ ! *** ! *** Can't find GSL configuration info. Is GSL installed? ! *** Get GSL at http://www.gnu.org/software/gsl ! ] ) unless %gsl; ! my $MIN_GSL_VERSION = "1.11"; *************** *** 115,123 **** open my $fh, ">", "$path_system" or die "Could not create $path_system : $!"; my $current_version; ! if (defined $gv) { ! if ($gv =~ m{\A(\d+(?:\.\d+)+)}) { $current_version = $1; my @current = split /\./, $current_version; print $fh "#define GSL_MAJOR_VERSION $current[0]\n"; --- 124,133 ---- open my $fh, ">", "$path_system" or die "Could not create $path_system : $!"; + my $current_version; ! if (defined $gsl{version}) { ! if ($gsl{version} =~ m{\A(\d+(?:\.\d+)+)}) { $current_version = $1; my @current = split /\./, $current_version; print $fh "#define GSL_MAJOR_VERSION $current[0]\n"; *************** *** 126,164 **** if (GSLBuilder::cmp_versions($current_version, $MIN_GSL_VERSION) == -1) { printf " *** ! *** You need to have GSL %s or greater installed. (You have $gv). *** Get GSL at http://www.gnu.org/software/gsl\n", $MIN_GSL_VERSION; exit 1; } else { ! print "Found GSL $gv (via gsl-config) installed in $gsl_prefix, CFLAGS=$gsl_cflags, $gsl_libs\n"; } } else { print " *** ! *** Can't parse GSL version $gv. *** Will continue and keep my fingers crossed for luck. "; } - } else { - print " - *** - *** Can't find GSL configuration info. Is GSL installed? - *** Get GSL at http://www.gnu.org/software/gsl - "; - exit 1; } - close $fh or die "Could not close $path_system : $!"; ! modify_env(); ! ! print "Asking ExtUtils::PkgConfig with ENV{PKG_CONFIG_PATH}=" . ($ENV{PKG_CONFIG_PATH} || '') . "\n"; ! my %gsl_pkgcfg = ExtUtils::PkgConfig->find ('gsl'); ! my $pkgcfg_ver = $gsl_pkgcfg{'modversion'}; ! ! warn "pkgconfig version $pkgcfg_ver != gsl-config $gv possible misconfiguration" if $pkgcfg_ver ne $gv; ! ! my $ccflags = $gsl_pkgcfg{cflags}; # In case GSL in installed in the system-wide directory, $ccflags is # empty (because pkg-config remove -I/usr/include), but swig needs it --- 136,158 ---- if (GSLBuilder::cmp_versions($current_version, $MIN_GSL_VERSION) == -1) { printf " *** ! *** You need to have GSL %s or greater installed. (You have $gsl{version}). *** Get GSL at http://www.gnu.org/software/gsl\n", $MIN_GSL_VERSION; exit 1; } else { ! print "Found GSL $gsl{version}, CFLAGS=$gsl{cflags}, LIBS=$gsl{libs}\n"; } } else { print " *** ! *** Can't parse GSL version $gsl{version}. *** Will continue and keep my fingers crossed for luck. "; } } close $fh or die "Could not close $path_system : $!"; ! my $ccflags = $gsl{cflags}; # In case GSL in installed in the system-wide directory, $ccflags is # empty (because pkg-config remove -I/usr/include), but swig needs it *************** *** 178,185 **** $ccflags .= try_cflags("-g"); ! my $ldflags = "$gsl_pkgcfg{libs} -gsl"; ! $swig_flags = "$gsl_pkgcfg{cflags} $swig_flags"; if ( GSLBuilder::is_cygwin() && $Config{shrpenv} =~ m{\Aenv LD_RUN_PATH=(.*)\Z} ) { $ldflags .= " -L$1 -lperl"; --- 172,179 ---- $ccflags .= try_cflags("-g"); ! my $ldflags = "$gsl{libs} -gsl"; ! $swig_flags = "$gsl{cflags} $swig_flags"; if ( GSLBuilder::is_cygwin() && $Config{shrpenv} =~ m{\Aenv LD_RUN_PATH=(.*)\Z} ) { $ldflags .= " -L$1 -lperl"; *************** *** 276,282 **** } } ! sub modify_env { $ENV{PKG_CONFIG_PATH} ||= ''; # TODO: What about windows and darwin? --- 270,307 ---- } } ! ! ! sub find_via_gsl_config { ! ! my %info; ! ! for my $what ( [ version => '--version' ], ! [ prefix => '--prefix' ], ! [ cflags => '--cflags' ], ! [ libs => '--libs' ] ! ) { ! ! { ! ! my ($key, $flag ) = @$what; ! ! $info{$key} = qx{gsl-config $flag}; ! if ( $! ) { ! warn "error running gsl-config $flag: $!\n"; ! return (); ! } ! } ! ! return %info; ! ! } ! ! } ! ! ! sub find_via_pkg_config { ! $ENV{PKG_CONFIG_PATH} ||= ''; # TODO: What about windows and darwin? *************** *** 284,288 **** /usr/pkgconfig:/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/pkgconfig:/usr/libdata/pkgconfig:/usr/local/libdata/pkgconfig:/opt/pkgconfig: CARGOCULT ! $ENV{PKG_CONFIG_PATH} = $guess . $ENV{PKG_CONFIG_PATH}; } --- 309,326 ---- /usr/pkgconfig:/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/pkgconfig:/usr/libdata/pkgconfig:/usr/local/libdata/pkgconfig:/opt/pkgconfig: CARGOCULT ! chomp $guess; ! $ENV{PKG_CONFIG_PATH} = join( ':', $ENV{PKG_CONFIG_PATH}, $guess ); ! ! # this will die if not found ! my %info = eval { ExtUtils::PkgConfig->find ('gsl') }; ! ! if ( $@ ) { ! warn $@; ! return (); ! } ! ! $info{version} = delete $info{modversion}; ! ! return %info; } #### End of Patch data #### #### ApplyPatch data follows #### # Data version : 1.0 # Date generated : Fri Mar 22 16:24:00 2013 # Generated by : makepatch 2.04 # Recurse directories : Yes # Excluded files : (\A|/).*\~\Z # (\A|/).*\.a\Z # (\A|/).*\.bak\Z # (\A|/).*\.BAK\Z # (\A|/).*\.elc\Z # (\A|/).*\.exe\Z # (\A|/).*\.gz\Z # (\A|/).*\.ln\Z # (\A|/).*\.o\Z # (\A|/).*\.obj\Z # (\A|/).*\.olb\Z # (\A|/).*\.old\Z # (\A|/).*\.orig\Z # (\A|/).*\.rej\Z # (\A|/).*\.so\Z # (\A|/).*\.Z\Z # (\A|/)\.del\-.*\Z # (\A|/)\.make\.state\Z # (\A|/)\.nse_depinfo\Z # (\A|/)core\Z # (\A|/)tags\Z # (\A|/)TAGS\Z # p 'Build.PL' 8597 1363983549 0100444 #### End of ApplyPatch data #### #### End of Patch kit [created: Fri Mar 22 16:24:00 2013] #### #### Patch checksum: 250 7088 40080 #### #### Checksum: 268 7781 31641 ####
Howdy Sisyphus, I totally missed this bug report and things have changed a bit in the mean-time. Please give the latest Math::GSL a try and open up a new ticket for troubles that you run into. Thanks for your contributions! Duke On Mon Jul 09 22:51:06 2012, SISYPHUS wrote: Show quoted text
> Attached is a patch to Build.PL that fixes part of the problem. > > Why on earth we want to to prefix $ENV{PKG_CONFIG_PATH} with $guess is > beyond me ... but I've left that as is. > > Does $ENV{PKG_CONFIG_PATH} really just ignore embedded newlines on *nix > ? ($guess ends with a newline, which my patch then removes.) > > Anyway, with that patch in place, I can successfully run 'perl Build.PL' > on windows. > > The real annoyance is that whenever I run 'perl build clean' it cleans > up a large number of the source files. So I have to have a special > backup tarball that I can extract to replace them. (I can't just extract > the Math-GSL-0.27 source again, because that will overwrite my corrected > Build.PL, and any other changes I've made.) > As a result (mainly) of that tedium, I got sick of trying to work out > the reason that, in inc/GSLBuilder.pm's get_binding_version(), > $self->{properties}->{current_version} is always empty (is it because > Build.PL's $gv never gets set for me?), so I just hard coded it to 1.15, > and everything went ok. > At least, I was then able to build for 32-bit perl-5.16.0. > Of course, when my build script moved on to try to build for the next > (different) version of perl, it failed because the 'perl build clean' at > the end of the 5.16.0 build had removed vital pieces of the > Math-GSL-0.27 source. > > Cheers, > Rob