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

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

Niko Tyni
April 28, 2011 08:02
[perl #89478] [PATCH] EU::CBuilder shouldn't override $Config{ccflags} with $ENV{CFLAGS}
Message ID:
# New Ticket Created by  Niko Tyni 
# Please include the string:  [perl #89478]
# in the subject line of all future correspondence about this issue. 
# <URL: >

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 <> 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
> >
> 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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About