Skip Menu |

This queue is for tickets about the IO-Tty CPAN distribution.

Report information
The Basics
Id: 69477
Status: resolved
Priority: 0/
Queue: IO-Tty

People
Owner: TODDR [...] cpan.org
Requestors: DOUGW [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.10
Fixed in: 1.12



Uses MakeMaker, but does not honor PERL_MM_OPT environment variable. I have PERL_MM_OPT set to, e.g., 'CC=/alternate/cc LD=/alternate/ld PREFIX=~/perl', but make 'perl Makefile.PL' does not look for my alternate cc and instead relies on the wrong 'cc' that is in Config.pm (don't blame me, I did not build perl). Other modules compile fine, but this one does not find the right cc.
I promise I'm not trying to blow you off with this reply, but I suspect this has more to do with one of the 20 command line Makefile.PL options you have to pass to get this right. For starters, Could I get: 1. perl -V 2. perl -MExtUtils::MakeMaker -e 'print "$ExtUtils::MakeMaker::VERSION\n"'
Also does not take command line options for CC=.... for 'perl Makefile.PL'. I did hack Makefile.PL to take my options, but don't have a proper patch yet to, e.g., first get options (CC,CCFLAGS,LDFLAGS) from command line, then from PERL_MM_OPT, then from Config.pm.
On Thu Jul 14 12:32:27 2011, DOUGW wrote: Show quoted text
> Also does not take command line options for CC=.... for 'perl > Makefile.PL'. I did hack Makefile.PL to take my options, but don't have > a proper patch yet to, e.g., first get options (CC,CCFLAGS,LDFLAGS) from > command line, then from PERL_MM_OPT, then from Config.pm.
There are known bugs in ExtUtils::CBuilder with cause CFLAGS to suppress %Config options. This is fixed in blead but not released to CPAN. From what I can tell, EU::MM has similar problems.
On Thu Jul 14 12:23:09 2011, TODDR wrote: Show quoted text
> I promise I'm not trying to blow you off with this reply, but I > suspect this has more to do with > one of the 20 command line Makefile.PL options you have to pass to get > this right.
perl 5.8.8 ExtUtils::MakeMaker 6.56 But the problem is that the Makefile.PL directly uses Config.pm settings to run cc (with ccflags and ldflags) options before it ever passes off to ExtUtils::MakeMaker. It needs to first try and get them from the command line then the PERL_MM_OPT variable.
Show quoted text
> But the problem is that the Makefile.PL directly uses Config.pm settings > to run cc (with ccflags and ldflags) options before it ever passes off > to ExtUtils::MakeMaker. It needs to first try and get them from the > command line then the PERL_MM_OPT variable.
Fair enough. I just looked at Makefile.PL and I now agree with you. It's not really doing it the right way. The only problem is that this would be a significant re-write of Makefile.PL to get it working right. Patches are welcome and might go in quickly. But I can tell you I won't have a chance to re-write it any time soon.
Actually based on a conversation the other day, I might be able to get this to work by shipping Devel::CheckLib and using that in Makefile.PL to simplify this.
On Thu Jul 14 12:45:31 2011, TODDR wrote: Show quoted text
> working right. Patches are welcome and might go in quickly. But I can > tell you I won't have a > chance to re-write it any time soon.
Not saying this is 100% correct, but 'it works for me', in case you don't find another solution. No rush on my part..I got it built.
Subject: Makefile.PL.diff
--- Makefile.PL.old Thu Jul 14 09:50:27 2011 +++ Makefile.PL Thu Jul 14 10:53:56 2011 @@ -4,7 +4,23 @@ use IO::File; use Config qw(%Config); -my $flags = "$Config{ccflags} $Config{ldflags}"; +my %cfg; +@cfg{qw(cc ccflags ldflags)} = @Config{qw(cc ccflags ldflags)}; +for my $arg (@ARGV) { + if ( /^(CC|CCFLAGS|LDFLAGS)=(.*)/i ) { + $cfg{lc($1)} = $2; + } +} +if ($ENV{PERL_MM_OPT}) { + # Split on whitespace just like EU::MM + for ( split ' ', $ENV{PERL_MM_OPT} ) { + if ( /^(CC|CCFLAGS|LDFLAGS)=(.*)/i ) { + $cfg{lc($1)} = $2; + } + } +} + +my $flags = "$cfg{ccflags} $cfg{ldflags}"; $flags =~ s/([^A-Za-z0-9 -_])/\\$1/g; # escape shell-metachars $|=1; # to see output immediately @@ -72,12 +88,12 @@ ESQ close(TST); -if (system("$Config{'cc'} $flags compilerok.c > compilerok.log 2>&1")) { +if (system("$cfg{'cc'} $flags compilerok.c > compilerok.log 2>&1")) { die <<"__EOT__"; -ERROR: cannot run the configured compiler '$Config{'cc'}' +ERROR: cannot run the configured compiler '$cfg{'cc'}' (see conf/compilerok.log). Suggestions: -1) The complier '$Config{'cc'}' is not in your PATH. Add it +1) The complier '$cfg{'cc'}' is not in your PATH. Add it to the PATH and try again. OR 2) The compiler isn't installed on your system. Install it. OR 3) You only have a different compiler installed (e.g. 'gcc'). @@ -148,7 +164,7 @@ close(TST); print "Looking for $f()" . "." x (13-length($f)) . " "; - if (system("$Config{'cc'} $flags $funcs{$f} functest_$f.c > functest_$f.log 2>&1")) { + if (system("$cfg{'cc'} $flags $funcs{$f} functest_$f.c > functest_$f.log 2>&1")) { print "not found.\n"; } else { $define{"-DHAVE_\U$f"} = undef; @@ -175,7 +191,7 @@ ESQ close(TST); print "Looking for $h" . "." x (15-length($h)) . " "; - if(system("$Config{'cc'} $flags headtest_$def.c > headtest_$def.log 2>&1")) { + if(system("$cfg{'cc'} $flags headtest_$def.c > headtest_$def.log 2>&1")) { print "not found.\n" } else { @@ -253,7 +269,7 @@ __EOT__ close(TST); - if (system("$Config{'cc'} $flags @{[keys %define]} ttsymtest_$s.c >ttsymtest_$s.log 2>&1")) { + if (system("$cfg{'cc'} $flags @{[keys %define]} ttsymtest_$s.c >ttsymtest_$s.log 2>&1")) { print SUB qq{newCONSTSUB(stash, "$s", newSV(0));\n}; # now check if the symbol is defined (should have an error message # for line 29999 in the logfile)
I'll take a look at this later this week.
On Thu Jul 14 14:02:10 2011, DOUGW wrote: Show quoted text
> On Thu Jul 14 12:45:31 2011, TODDR wrote: >
> > working right. Patches are welcome and might go in quickly. But I can > > tell you I won't have a > > chance to re-write it any time soon.
> > Not saying this is 100% correct, but 'it works for me', in case you > don't find another solution. No rush on my part..I got it built. >
Added to github. Will go out in a devel release today. commit f450f7fe4a28f3305c85b2ef49945fe96701f3c5 Author: Todd Rinaldo <toddr@cpan.org> Date: Mon May 5 10:17:59 2014 -0500 Add support for PERL_MM_OPT in IO::Tty builder RT 69477 ChangeLog | 4 ++-- Makefile.PL | 30 +++++++++++++++++++++++------- 2 files changed, 25 insertions(+), 9 deletions(-)