Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.93k stars 551 forks source link

Perl 5.34.0 build breaks on Darwin gcc4 #18902

Open hfath opened 3 years ago

hfath commented 3 years ago

The Perl 5.6.34.0 distribution build employs

-Wno-error:implicit-function-declaration

without configure checking whether -Wno-error: is supported.

This breaks building Perl on Darwin 8 / Mac OS X 10.4, whose native toolchain (Xcode) sports gcc v4.

The pkgsrc build can work around this by conditionallly stripping the option, but shouldn't have to.

jkeenan commented 3 years ago

The Perl 5.6.34.0 distribution build employs

Are you referring to perl-5.34.0, released to CPAN last month?

That's a different thing from perl-5.6, which was last released 21 years ago.

-Wno-error:implicit-function-declaration

without configure checking whether -Wno-error: is supported.

This breaks building Perl on Darwin 8 / Mac OS X 10.4, whose native toolchain (Xcode) sports gcc v4.

The pkgsrc build can work around this by conditionallly stripping the option, but shouldn't have to.

What is the source code you are working from?

Also, can you supply the output of perl -Ilib -V for the platform on which you are building?

Thank you very much. Jim Keenan

Leont commented 3 years ago

Mac OS X 10.4 is ancient (16 years old), as is gcc-4. Why are you trying to build perl on such an old platform?

hfath commented 3 years ago

The Perl 5.6.34.0 distribution build employs

Are you referring to perl-5.34.0, released to CPAN last month?

Make that Perl v5.34.0, sorry. Brain glitch.

Also, can you supply the output of perl -Ilib -V for the platform on which you are building?

Here goes:

perl_Ilib_V.txt

Cheerio, Hauke

hfath commented 3 years ago

Mac OS X 10.4 is ancient (16 years old), as is gcc-4. Why are you trying to build perl on such an old platform?

Because I can?

And because I want to build other stuff from pkgsrc, and lang/perl5 is rather essential.

Cheerio, Hauke

jkeenan commented 3 years ago

Mac OS X 10.4 is ancient (16 years old), as is gcc-4. Why are you trying to build perl on such an old platform?

Because I can?

And because I want to build other stuff from pkgsrc, and lang/perl5 is rather essential.

Cheerio, Hauke

ack-ing the repository for the strings you cited, I get:

$ ack '(no-error|implicit-function-declaration)' .
lib/ExtUtils/MM_Darwin.pm
65:    $self->{CCFLAGS} .= " -Wno-error=implicit-function-declaration";

lib/ExtUtils/CBuilder/Platform/darwin.pm
20:  $cf->{ccflags} .= ($cf->{ccflags} ? ' ' : '').'-Wno-error=implicit-function-declaration';

dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/darwin.pm
20:  $cf->{ccflags} .= ($cf->{ccflags} ? ' ' : '').'-Wno-error=implicit-function-declaration';

dist/ExtUtils-CBuilder/Changes
14:  - Fix compilation on darwin with XCode 12 (-Werror=implicit-function-declaration) 

cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Darwin.pm
65:    $self->{CCFLAGS} .= " -Wno-error=implicit-function-declaration";

So I suggest you play around with those files, and also with hints/darwin.sh to see what works for you.

hfath commented 3 years ago

ack-ing the repository for the strings you cited, I get: [...]

Thanks; I'll look at that.

Cheerio, Hauke

jkeenan commented 3 years ago

ack-ing the repository for the strings you cited, I get: [...]

Thanks; I'll look at that.

Cheerio, Hauke

The directory I was searching through above held a built perl in it. After doing git clean -dfx I ran the same ack and got more focused results:

$ ack '(no-error|implicit-function-declaration)' .
dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/darwin.pm
20:  $cf->{ccflags} .= ($cf->{ccflags} ? ' ' : '').'-Wno-error=implicit-function-declaration';

dist/ExtUtils-CBuilder/Changes
14:  - Fix compilation on darwin with XCode 12 (-Werror=implicit-function-declaration) 

cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Darwin.pm
65:    $self->{CCFLAGS} .= " -Wno-error=implicit-function-declaration";

So you have to look at one module which is maintained here in blead and one module which is maintained on CPAN.

I should add that I understand where @LeonT is coming from with his question about the age of the platform/C-compiler combination you're interested in. I too, owned an iBook G4 which started out as Mac OS 10.3 and was upgraded to 10.4. But it could never be upgraded to 10.5 because of the shift from PowerPC to Intel chips. Nonetheless, I continued to try to build and test Perl 5 blead on it till about 3 years ago, when the disk accidentally got wiped. At that point my iBook was clearly the oldest machine on the planet on which anyone was attempting to build perl.

However, by 2014 I couldn't get updates for Safari and web pages were extremely slow to load. Building perl with make often failed halfway through, though it usually eventually succeeded.

So I doubt we could promise any extended support for this platform. We would have no way of corroborating whatever results you might be able to hack up. We might be able to support gcc-4 on, say, Debian Linux, but the PowerPC Macs are way past EOL.

Thank you very much. Jim Keenan

hfath commented 3 years ago

On Thu, 17 Jun 2021 18:51:13 -0700, James E Keenan wrote:

So you have to look at one module which is maintained here in blead and one module which is maintained on CPAN.

Thanks for the comprehensive reply! I think I see more clearly now.

What is the proper way to conditionally handle a platform and/or compiler dependency in darwin.pm and MM_Darwin.pm?

Cheerio, Hauke

-- The ASCII Ribbon Campaign Hauke Fath () No HTML/RTF in email Institut für Nachrichtentechnik /\ No Word docs in email TU Darmstadt Respect for open standards Ruf +49-6151-16-21344

hfath commented 3 years ago

On Thu, 17 Jun 2021 18:51:13 -0700, James E Keenan wrote:

The directory I was searching through above held a built perl in it.
After doing git clean -dfx I ran the same ack and got more focused results: [...]

Different find: What is the status of "hints/darwin.sh"?

The script has all the Darwin family history. If it is still used for the build, arguably this is where the "-Wno-error=..." should have gone in the first place.

Cheerio, Hauke

[Mailed from 10.4 / Powerbook G4. Cameron Kaiser's TenFourFox renders https://github.com/Perl/perl5/ just fine.]

-- The ASCII Ribbon Campaign Hauke Fath () No HTML/RTF in email Institut für Nachrichtentechnik /\ No Word docs in email TU Darmstadt Respect for open standards Ruf +49-6151-16-21344

ryandesign commented 3 years ago

-Wno-error=implicit-function-declaration

Perl should not employ this flag. It was added to counteract the fact that Xcode 12 and later default to considering implicit function declarations an error, but you should not suppress this error. Apple made that condition an error intentionally, because not doing so can result in wrong builds on Apple Silicon Macs that can cause crashes. You must fix the problems correctly instead: always declare or define a function before you use it. In MacPorts, we have already reverted the addition of this flag. See https://trac.macports.org/ticket/61630.

Leont commented 3 years ago

-Wno-error=implicit-function-declaration

Perl should not employ this flag. It was added to counteract the fact that Xcode 12 and later default to considering implicit function declarations an error, but you should not suppress this error. Apple made that condition an error intentionally, because not doing so can result in wrong builds on Apple Silicon Macs that can cause crashes. You must fix the problems correctly instead: always declare or define a function before you use it. In MacPorts, we have already reverted the addition of this flag. See https://trac.macports.org/ticket/61630.

This does sound sensible. I really don't think we have tested or understood this change nearly enough before we merged it.

sevan commented 1 year ago

There was a someone smoking on Tiger up until recently. Oldest version of OS X support by Perl 5 is 10.4, might as well test / build against it. Happy to pick up running smoke tests.

Xcode 12 shipped with Catalina 15.4 according to https://xcodereleases.com so we just need to guard off the additional flags on clang 12 and newer

% cc -v
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

or Darwin 19.4 and above?

ryandesign commented 1 year ago

No. -Wno-error=implicit-function-declaration should be removed from Perl unconditionally. If that breaks any modules, fix the modules. It has been erroneous for programmers to attempt to call a function before declaring it ever since the C99 standard was introduced 24 years ago. Perl should not attempt to continue to legitimize this antique programming practice, especially since it can cause incorrect behavior on ARM processors.

sevan commented 1 year ago

I'm not suggesting removing it unconditionally. I'm suggesting not specifying it on older systems/versions of toolchains where it's not supported and breaks the build. Anyone on a current system will get the flag. Developing on Catalina or newer is likely the common scenario, right?

sevan commented 1 year ago

I misunderstood what you meant and assumed you were defending keeping the flag. No objection to dropping it completely.