develooper Front page | perl.perl5.porters | Postings from April 2011

[perl #89478] [PATCH] EU::CBuilder shouldn't override $Config{ccflags} with $ENV{CFLAGS}

From:
Niko Tyni
Date:
April 28, 2011 08:02
Subject:
[perl #89478] [PATCH] EU::CBuilder shouldn't override $Config{ccflags} with $ENV{CFLAGS}
Message ID:
rt-3.6.HEAD-32285-1304002922-1160.89478-75-0@perl.org
# New Ticket Created by  Niko Tyni 
# Please include the string:  [perl #89478]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=89478 >


On Wed, Apr 27, 2011 at 05:37:56PM -0500, Craig A. Berry wrote:
> On Wed, Apr 27, 2011 at 4:39 PM, Niko Tyni <ntyni@debian.org> wrote:
> 
> > Failed 4 tests out of 2037, 99.80% okay.
> >        ../cpan/Module-Build/t/xs.t
> >        ../dist/ExtUtils-ParseXS/t/basic.t
> >        ../dist/ExtUtils-ParseXS/t/more.t
> >        ../dist/ExtUtils-ParseXS/t/usage.t
> >
> > What's happening seems to be that when CFLAGS is set, it overrides
> > other flags in ExtUtils::CBuilder. One of these, -D_FILE_OFFSET_BITS=64,
> > is apparently crucial on this platform for some reason.
> 
> > Bisecting shows the crucial thing that breaks this is
> > -D_FILE_OFFSET_BITS=64 missing. Don't know why.
> 
> > It looks like this is a change in ExtUtils::CBuilder, maybe
> >  https://github.com/dagolden/extutils-cbuilder/commit/e653d24a
> 
> I doubt there's anything crucial about the particular flag, but rather
> it's the fact that you're building extensions using flags that give
> you code that is binary incompatible with the perl binary it's being
> built against.  It looks like your expectation is that you can add an
> optimization flag by specifying only that flag in CFLAGS.  Sounds
> reasonable, but clearly what EU::CB is doing is dropping everything it
> got from $Config{ccflags} and replacing rather than supplementing it
> with what you gave it in CFLAGS.

Yes, I see. Thanks. Perlbugging this with the attached proposed patch.
FWIW, I think LDFLAGS should be treated in the same way.

> With options like -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64' used
> to build Perl but dropped when testing extension building, you could
> be getting a different and incompatible stat structure or other binary
> incompatible differences between the extension and the Perl core.
> 
> It seems like the principle of least surprise might be to make EU::CB
> take CFLAGS as a supplement to $Config{ccflags} rather than as a
> replacement.  It would still be possible to create binary
> incompatibilities, but perhaps less likely.
-- 
Niko Tyni   ntyni@debian.org



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About