Opened 7 months ago

Last modified 7 months ago

#71435 new defect

Perl 5.34 possibly needs a patch on Tiger because of " $cf->{ccflags} .= ($cf->{ccflags} ? ' ' : '').'-Wno-error=implicit-function-declaration';"

Reported by: ballapete (Peter "Pete" Dyballa) Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.10.5
Keywords: tiger Cc:
Port: perl5.34

Description (last modified by ryandesign (Ryan Carsten Schmidt))

/opt/local/lib/perl5/5.34/ExtUtils/CBuilder/Platform/darwin.pm has these 26 lines:

      1 package ExtUtils::CBuilder::Platform::darwin;
      2 
      3 use warnings;
      4 use strict;
      5 use ExtUtils::CBuilder::Platform::Unix;
      6 
      7 our $VERSION = '0.280236'; # VERSION
      8 our @ISA = qw(ExtUtils::CBuilder::Platform::Unix);
      9 
     10 sub compile {
     11   my $self = shift;
     12   my $cf = $self->{config};
     13 
     14   # -flat_namespace isn't a compile flag, it's a linker flag.  But
     15   # it's mistakenly in Config.pm as both.  Make the correction here.
     16   local $cf->{ccflags} = $cf->{ccflags};
     17   $cf->{ccflags} =~ s/-flat_namespace//;
     18 
     19   # XCode 12 makes this fatal, breaking tons of XS modules
     20   $cf->{ccflags} .= ($cf->{ccflags} ? ' ' : '').'-Wno-error=implicit-function-declaration';
     21 
     22   $self->SUPER::compile(@_);
     23 }
     24 
     25 
     26 1;

Lines #19 and #20 are the interesting ones. When testing Perl Modules that use Build.PL to build with self-written Portfiles I encounter complaints, and compiler errors about the passed argument -Wno-error=implicit-function-declaration. I think MacPorts' regular Portfiles use this work-around:

    compiler.blacklist-append \
                     *gcc-4.*

together with

    perl5.use_module_build

Shouldn't a patch for /opt/local/lib/perl5/5.34/ExtUtils/CBuilder/Platform/darwin.pm be preferred? The XCode 12 problem does not exist in a dozen of Mac OS X and macOS versions and could be sharper formulated.

Change History (4)

comment:1 Changed 7 months ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)

-Wno-error=implicit-function-declaration should not be used. Instead, functions should be declared before they are called.

comment:2 Changed 7 months ago by ballapete (Peter "Pete" Dyballa)

That's clearly understood (by me and you). My observation when testing Perl Modules that are built and installed via CBuilder is that exactly this argument is passed to the C or C++ compiler during tests, to compile test programmes, which does not come from the module's files. So it has to come out of the system, Perl 5.34 in this case. And /opt/local/lib/perl5/5.34/ExtUtils/CBuilder/Platform/darwin.pm seems to be the culprit. (OK, I actually do not understand what this is doing, it is certainly not removing -Wno-error=implicit-function-declaration from a list of arguments.)

Therefore I think it is less work and overhead to leave the correction of XCode 12 to those Macs that have it and remove or comment it on the others, make the work-around not needed. I see the same file on Sonoma with Xcode 16

comment:3 Changed 7 months ago by ballapete (Peter "Pete" Dyballa)

By simply invoking gcc-apple-4.2 to compile some C code file with -Wno-error=implicit-function-declaration I found that MacPorts' GCC 4.2 does understand this option. But since it was decided to use the system's antique tools for tests these have to fail systematically.

comment:4 Changed 7 months ago by ballapete (Peter "Pete" Dyballa)

See https://rt.cpan.org/Ticket/Display.html?id=157638. Here David Cantrell recommends to use EU::CB (ExtUtils::CBuilder) in version 0.280234 to get rid of -Wno-error=implicit-function-declaration.

Note: See TracTickets for help on using tickets.