On Sun, May 29, 2011 at 07:46:06PM +0100, Dominic Hargreaves wrote: > Package: perl-modules > Version: 5.14.0-1 > Severity: important > > This is a similar issue to that in > <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=624460> > where Extutils::CBuilder was fixed to not overwrite > $Config{ccflags} with $ENV{CFLAGS}.
> Again, this isn't a new problem, but it's only with 5.14 that it's fatal. It's a bit hard to say whether this is a bug in EU::MM or the modules overriding CCFLAGS. The documentation doesn't specify one way or the other, but at least libdbd-oracle-perl seems to get it right with $opts{CCFLAGS} = "-P $Config{ccflags}" if $Config{cc} eq 'bcc32'; # force C++ Also, the last test in cpan/ExtUtils-MakeMaker/t/MM_Unix.t actually checks that CCFLAGS overrides anything else, so this seems to be the intended behaviour. However, I can't think of a case where overriding $Config{ccflags} is the correct thing to do. The attached naive patch appends CCFLAGS to $Config{ccflags}. Could you please try and see if it fixes things for you? Ideally, it would also be useful to see if it breaks anything that used to work without it. (The patch is with -p1 from the EU::MM repository so it won't apply to the perl sources with just 'git am'). Once that's confirmed, I think the issue needs to be discussed upstream before applying this for the Debian packages. -- Niko Tyni nt...@debian.org
>From 2d6be9e8e8c3901a61689cd021e74d53f8ed28e1 Mon Sep 17 00:00:00 2001 From: Niko Tyni <nt...@debian.org> Date: Mon, 30 May 2011 22:54:24 +0300 Subject: [PATCH] Append CCFLAGS to $Config{ccflags} instead of overriding it As seen in http://bugs.debian.org/628522 and https://rt.cpan.org/Ticket/Display.html?id=67990 compiling XS extensions without $Config{ccflags} can break the binary interface on some platforms. There does not seem to be any correct use case for compiling a module without $Config{ccflags}, so any extra CCFLAGS should be appended to those rather than overriding them. --- lib/ExtUtils/MM_Unix.pm | 6 +++++- t/MM_Unix.t | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/ExtUtils/MM_Unix.pm b/lib/ExtUtils/MM_Unix.pm index a3b7e9d..5e0758a 100644 --- a/lib/ExtUtils/MM_Unix.pm +++ b/lib/ExtUtils/MM_Unix.pm @@ -250,7 +250,11 @@ sub cflags { $cflags{$_} =~ s/^\s+//; $cflags{$_} =~ s/\s+/ /g; $cflags{$_} =~ s/\s+$//; - $self->{uc $_} ||= $cflags{$_}; + if (/ccflags/ && $self->{uc $_}) { + $self->{uc $_} = "$cflags{$_} " . $self->{uc $_}; + } else { + $self->{uc $_} ||= $cflags{$_}; + } } if ($self->{POLLUTE}) { diff --git a/t/MM_Unix.t b/t/MM_Unix.t index 55c29e3..5f76e08 100644 --- a/t/MM_Unix.t +++ b/t/MM_Unix.t @@ -12,7 +12,7 @@ BEGIN { plan skip_all => 'Non-Unix platform'; } else { - plan tests => 110; + plan tests => 112; } } @@ -20,6 +20,7 @@ BEGIN { use_ok( 'ExtUtils::MM_Unix' ); } use strict; use File::Spec; +use Config; my $class = 'ExtUtils::MM_Unix'; @@ -220,6 +221,9 @@ foreach (qw/ EXPORT_LIST PERL_ARCHIVE PERL_ARCHIVE_AFTER /) $t->cflags(); # Brief bug where CCFLAGS was being blown away - is( $t->{CCFLAGS}, '-DMY_THING', 'cflags retains CCFLAGS' ); + like( $t->{CCFLAGS}, "/-DMY_THING/", 'cflags retains CCFLAGS' ); + + like( $t->{CCFLAGS}, "/\Q$Config{ccflags}\E/", 'cflags does not override $Config{ccflags} with CCFLAGS' ); + like( $t->{CCFLAGS}, '/ -DMY_THING$/', 'cflags appends CCFLAGS to $Config{ccflags}' ); } -- 1.7.5.1