Skip Menu |

This queue is for tickets about the ExtUtils-MakeMaker CPAN distribution.

Report information
The Basics
Id: 3081
Status: resolved
Worked: 2.5 hours (150 min)
Priority: 0/
Queue: ExtUtils-MakeMaker

People
Owner: ETJ [...] cpan.org
Requestors: steve.hay [...] uk.radan.com
Cc:
AdminCc:

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



Subject: PASTHRU doesn't work on Win32
I'm calling a Makefile.PL with a DEFINE command-line argument, and I find that it doesn't get passed through to Makefile.PL's in sub-directories. I've installed the latest ExtUtils::MakeMaker (6.11); I'm running Perl 5.8.0 on Windows XP (MS VC++ 6.0). It looks to me like the pasthru() override in MM_Win32.pm is somewhat lacking. I tried calling the superclass method first and then appending the Win32-specific "-nologo" bit, but that simply created a Makefile PASTHRU section that referenced PASTHRU_DEFINE, which is not setup anywhere. If you need a good test case to try this out on, I'm trying to build XML-Parser (2.32) using the command-line perl Makefile.PL EXPATINCPATH=C:/expat/include EXPATLIBPATH=C:/expat/lib DEFINE=-DXML_STATIC The two EXPAT* options here are explicitly handled by XML-Parser's own Makefile.PL; the DEFINE option needs to be passed through to the Makefile.PL in the Expat sub-directory, but it isn't happening. A fix in time for perl-5.8.1 would be much appreciated.
Date: Tue, 29 Jul 2003 13:57:58 -0700
From: Michael G Schwern <schwern [...] pobox.com>
To: via RT <bug-ExtUtils-MakeMaker [...] rt.cpan.org>
CC: "AdminCc of cpan Ticket #3081": ;
Subject: Re: [cpan #3081] PASTHRU doesn't work on Win32
RT-Send-Cc:
On Tue, Jul 29, 2003 at 05:09:50AM -0400, via RT wrote: Show quoted text
> It looks to me like the pasthru() override in MM_Win32.pm is somewhat lacking. I tried calling the superclass method first and then appending the Win32-specific "-nologo" bit, but that simply created a Makefile PASTHRU section that referenced PASTHRU_DEFINE, which is not setup anywhere. > > If you need a good test case to try this out on, I'm trying to build XML-Parser (2.32) using the command-line > > perl Makefile.PL EXPATINCPATH=C:/expat/include EXPATLIBPATH=C:/expat/lib DEFINE=-DXML_STATIC > > The two EXPAT* options here are explicitly handled by XML-Parser's own Makefile.PL; the DEFINE option needs to be passed through to the Makefile.PL in the Expat sub-directory, but it isn't happening. > > A fix in time for perl-5.8.1 would be much appreciated.
Well, all I've got as far as compilers go on Windows is Cygwin and MinGW. So if you want me to investigate this, I'll need a legit copy of VC++ that'll work on Win98, though I'm probably not the best bet for fixing a problem with recursive XS builds on Windows. -- Do not try comedy at home! Milk & Cheese are advanced experts! Attempts at comedy can be dangerously unfunny!
From: schwern [...] pobox.com
[SHAY - Tue Jul 29 05:09:49 2003]: Show quoted text
> I've installed the latest ExtUtils::MakeMaker (6.11); I'm running Perl > 5.8.0 on Windows XP (MS VC++ 6.0).
PS Did this work with a stock 5.8.0? ie. If you install MakeMaker 6.03 or 6.05 does it work?
From: schwern [...] pobox.com
# this is a test of the comment logging system
RT-Send-CC: schwern [...] pobox.com
[MSCHWERN - Tue Jul 29 17:00:32 2003]: Show quoted text
> [SHAY - Tue Jul 29 05:09:49 2003]:
> > I've installed the latest ExtUtils::MakeMaker (6.11); I'm running
> Perl
> > 5.8.0 on Windows XP (MS VC++ 6.0).
> > PS Did this work with a stock 5.8.0? ie. If you install MakeMaker > 6.03 or 6.05 does it > work?
[Here's my second attempt at a reply -- and it really is a "reply" this time, not a "comment". Hope it works this time.] The -DXML_STATIC doesn't get passed through using MM 6.05 either, so it's not a new bug. Since you haven't got a VC++ setup yourself to try and fix this with, perhaps could you guide me in fixing it? Here's my first attempt at it (diffed against MM 6.15 now): --- MM_Win32.pm.orig 2003-07-06 00:13:06.000000000 +0100 +++ MM_Win32.pm 2003-08-04 10:14:34.000000000 +0100 @@ -430,7 +430,9 @@ sub pasthru { my($self) = shift; - return "PASTHRU = " . ($NMAKE ? "-nologo" : ""); + my $pasthru = $self->SUPER::pasthru(); + $pasthru =~ s/PASTHRU\s*=\s*/PASTHRU = -nologo / if $NMAKE; + return $pasthru; } Without this patch, the Makefile in XML-Parser's Expat sub-directory contains this: PASTHRU = -nologo and the build fails because -DXML_STATIC is not being used within that sub-directory. With the patch, the Makefile now contains: PASTHRU = -nologo LIB="$(LIB)"\ LIBPERL_A="$(LIBPERL_A)"\ LINKTYPE="$(LINKTYPE)"\ PREFIX="$(PREFIX)"\ OPTIMIZE="$(OPTIMIZE)"\ PASTHRU_DEFINE="$(PASTHRU_DEFINE)"\ PASTHRU_INC="$(PASTHRU_INC)" This is better, but not yet quite right because PASTHRU_DEFINE (and LIB and PASTHRU_INC) is not defined anywhere! Presumably PASTHRU_DEFINE is what should store the -DXML_STATIC option? Where are these things supposed to be setup? Looking at the MM source code, I can see a few places where PASTHRU_DEFINE gets used, but nowhere, even in the Unix case, where it is defined.
Is this bug still a problem with 5.8.6 and MakeMaker 6.24?
[MSCHWERN - Thu Dec 9 17:57:55 2004]: Show quoted text
> Is this bug still a problem with 5.8.6 and MakeMaker 6.24?
Yes. With a fresh 5.8.6 + MM 6.24, the original example that I gave is still valid: Trying to build XML-Parser I want to have "DEFINE=-DXML_STATIC" as a Makefile.PL argument and have that passed-thru to the Expat/ sub-directory, but it doesn't happen. You may recall there was some work done by Jarkko and myself to fix this in the lead up to 5.8.1, but it was removed from 5.8.1-to-be just before release due to concerns over the regression risk. You can see the (long) p5p thread discussing this here: http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2003-08/thrd4.html#00272 Perl change #20561 is the one that pulled it out of 5.8.1-to-be. Attached is that change reformulated as a patch to put it back into MM 6.24. If I apply the attached patch then my XML-Parser example now works, and MM's own test suite still passes too. I'm not saying it's right, though. There are still worrying regression risks, and the issue seems to have cropped up several other times on p5p, e.g. http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2001-07/msg00150.html http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2003-07/msg01571.html - Steve
diff -ru ExtUtils-MakeMaker-6.24.orig/lib/ExtUtils/MM_Unix.pm ExtUtils-MakeMaker-6.24/lib/ExtUtils/MM_Unix.pm --- ExtUtils-MakeMaker-6.24.orig/lib/ExtUtils/MM_Unix.pm 2004-11-16 13:04:08.000000000 +0000 +++ ExtUtils-MakeMaker-6.24/lib/ExtUtils/MM_Unix.pm 2004-12-10 09:20:01.797487500 +0000 @@ -9,6 +9,7 @@ use Config qw(%Config); use File::Basename qw(basename dirname); use DirHandle; +use Text::ParseWords; use vars qw($VERSION @ISA $Is_OS2 $Is_VMS $Is_Win32 $Is_Win95 $Is_Dos $Is_VOS @@ -20,7 +21,7 @@ use ExtUtils::MakeMaker qw($Verbose neatvalue); -$VERSION = '1.45'; +$VERSION = '1.45_01'; require ExtUtils::MM_Any; @ISA = qw(ExtUtils::MM_Any); @@ -126,30 +127,30 @@ $cpp_cmd =~ s/^CCCMD\s*=\s*\$\(CC\)/$cpp/; push @m, ' .c.i: - '. $cpp_cmd . ' $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c > $*.i + '. $cpp_cmd . ' $(CCCDLFLAGS) "-I$(PERL_INC)" $(DEFINE) $(PASTHRU_DEFINE) $*.c > $*.i '; } push @m, ' .c.s: - $(CCCMD) -S $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c + $(CCCMD) -S $(CCCDLFLAGS) "-I$(PERL_INC)" $(DEFINE) $(PASTHRU_DEFINE) $*.c '; push @m, ' .c$(OBJ_EXT): - $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.c + $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(DEFINE) $(PASTHRU_DEFINE) $*.c '; push @m, ' .C$(OBJ_EXT): - $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.C + $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(DEFINE) $(PASTHRU_DEFINE) $*.C ' if !$Is_OS2 and !$Is_Win32 and !$Is_Dos; #Case-specific push @m, ' .cpp$(OBJ_EXT): - $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.cpp + $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(DEFINE) $(PASTHRU_DEFINE) $*.cpp .cxx$(OBJ_EXT): - $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.cxx + $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(DEFINE) $(PASTHRU_DEFINE) $*.cxx .cc$(OBJ_EXT): - $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(PASTHRU_DEFINE) $(DEFINE) $*.cc + $(CCCMD) $(CCCDLFLAGS) "-I$(PERL_INC)" $(DEFINE) $(PASTHRU_DEFINE) $*.cc '; join "", @m; } @@ -363,8 +364,10 @@ my($self,$libperl)=@_; return $self->{CONST_CCCMD} if $self->{CONST_CCCMD}; return '' unless $self->needs_linking(); + # PASTHRU_INC is defined explicitly by extensions + # wanting to do complex things. return $self->{CONST_CCCMD} = - q{CCCMD = $(CC) -c $(PASTHRU_INC) $(INC) \\ + q{CCCMD = $(CC) -c $(INC) $(PASTHRU_INC) \\ $(CCFLAGS) $(OPTIMIZE) \\ $(PERLTYPE) $(MPOLLUTE) $(DEFINE_VERSION) \\ $(XS_DEFINE_VERSION)}; @@ -3063,11 +3066,27 @@ my($sep) = $Is_VMS ? ',' : ''; $sep .= "\\\n\t"; - foreach $key (qw(LIB LIBPERL_A LINKTYPE PREFIX OPTIMIZE)) { + foreach $key (qw(LIB LIBPERL_A LINKTYPE PREFIX OPTIMIZE INC DEFINE)) { next unless defined $self->{$key}; - push @pasthru, "$key=\"\$($key)\""; + if ($key eq 'INC') { + # For INC we need to prepend parent directory but + # only if the parent directory is not absolute. + my ($o, $i) = $Is_VMS ? ('/Include=', 'i') : ('-I', ''); + my $inc = ''; + foreach (grep { /\S/ } parse_line(qr/\s*(?$i)$o/, 1, $self->{INC})) { + s/^"(.+)"\s*$/$1/o; + my $dir = File::Spec->file_name_is_absolute($_) ? $_ : File::Spec->catdir(File::Spec->updir, $_); + $dir = qq["$dir"] if $dir =~ / /; + $inc .= " $o$dir"; + } + push @pasthru, "INC=\"$inc\""; + } else { + push @pasthru, "$key=\"\$($key)\""; + } } + # PASTHRU_DEFINE and PASTHRU_INC are defined explicitly + # by extensions wanting to do really complex things. foreach $key (qw(DEFINE INC)) { next unless defined $self->{$key}; push @pasthru, "PASTHRU_$key=\"\$(PASTHRU_$key)\""; diff -ru ExtUtils-MakeMaker-6.24.orig/lib/ExtUtils/MM_Win32.pm ExtUtils-MakeMaker-6.24/lib/ExtUtils/MM_Win32.pm --- ExtUtils-MakeMaker-6.24.orig/lib/ExtUtils/MM_Win32.pm 2004-11-16 13:04:08.000000000 +0000 +++ ExtUtils-MakeMaker-6.24/lib/ExtUtils/MM_Win32.pm 2004-12-10 09:20:11.219121300 +0000 @@ -29,7 +29,7 @@ require ExtUtils::MM_Any; require ExtUtils::MM_Unix; @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); -$VERSION = '1.10'; +$VERSION = '1.10_01'; $ENV{EMXSHELL} = 'sh'; # to run `commands` @@ -427,7 +427,9 @@ sub pasthru { my($self) = shift; - return "PASTHRU = " . ($NMAKE ? "-nologo" : ""); + my $pasthru = $self->SUPER::pasthru(); + $pasthru =~ s/PASTHRU\s*=\s*/PASTHRU = -nologo / if $NMAKE; + return $pasthru; } diff -ru ExtUtils-MakeMaker-6.24.orig/t/MM_Win32.t ExtUtils-MakeMaker-6.24/t/MM_Win32.t --- ExtUtils-MakeMaker-6.24.orig/t/MM_Win32.t 2004-11-23 05:19:02.000000000 +0000 +++ ExtUtils-MakeMaker-6.24/t/MM_Win32.t 2004-12-10 09:19:11.033162100 +0000 @@ -254,8 +254,8 @@ # pasthru() { - my $pastru = "PASTHRU = " . ($Config{make} =~ /^nmake/i ? "-nologo" : ""); - is( $MM->pasthru(), $pastru, 'pasthru()' ); + my $pasthru = ($Config{make} =~ /^nmake/i ? "/-nologo/" : ""); + like( $MM->pasthru(), $pasthru, 'pasthru()' ); } package FakeOut;
RT-Send-CC: BINGOS [...] cpan.org
Ten years later, EUMM PR #168 now features tests (subdirs and subdirsstatic) that exercise this functionality, and fixes for it.
On Sat Jan 03 21:37:16 2015, ETJ wrote: Show quoted text
> Patched in https://github.com/Perl-Toolchain-Gang/ExtUtils- > MakeMaker/commit/fac50fd7f03dc88201a35d8a878b4cf514164fc1