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

Re: [perl #128972] Build failure on OS X 10.12 Sierra

Thread Previous
From:
Craig A. Berry
Date:
April 28, 2019 22:51
Subject:
Re: [perl #128972] Build failure on OS X 10.12 Sierra
Message ID:
CA+vYcVw84Xgf-RXef-m2XVqfiRdUtCqhmO6HdG_HQDORjpeELA@mail.gmail.com
On Thu, Mar 28, 2019 at 9:35 PM Karl Williamson via RT
<perlbug-followup@perl.org> wrote:
>
> On Thu, 15 Sep 2016 14:11:07 -0700, craig.a.berry@gmail.com wrote:
> > On Thu, Aug 18, 2016 at 1:51 AM, Mojca Miklavec <mojca@macports.org> wrote:
> > > On 18 August 2016 at 02:39, Tony Cook via RT wrote:
> > >>
> > >> This is fixed in blead, it may need a backport to 5.24/5.22.
> > >
> > > Thank you, I didn't check the git sources.
> > >
> > > Correction: 5.22 doesn't need that patch. It's only relevant for 5.24.
> >
> > So does Time::HiRes now use the system clock_gettime() on Sierra?
> >
> > Has anyone tried building on 10.12 with MACOSX_DEPLOYMENT_TARGET set
> > to some lower version in the environment, and then actually run Perl
> > (including Time::HiRes) in that older environment?  According to some
> > folks on the libcurl list:
> >
> > <https://curl.haxx.se/mail/lib-2016-09/0051.html>
> >
> > the new clock_gettime() functionality in Sierra is implemented as a
> > weak reference so it will always show up at compile time even if you
> > explicitly specify an older deployment target.  The current suggestion
> > is to add -Werror=partial-availability to the compiler flags with the
> > expectation that it will make configuration checks correctly fail.  I
> > don't have Sierra yet so I can't try it.
> >
>
> Craig, can you try it now?

Apologies for the late reply.  I didn't notice this until Karl gave me
a nudge off-list.  What I now have available are High Sierra (10.12)
and Mojave (10.13).  I tried building with this on Mojave:

$ cc --version
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

and configured like so:

$ export MACOSX_DEPLOYMENT_TARGET=10.11
$ ./Configure -Dusedevel -Accflags='-Werror=partial-availability'

but the build died when compiling Time::HiRes.  We did end up with
clock_gettime() emulated, which I think was the goal, but we also
ended up with a conflicting redefinition of clockid_t and pulled in
some _CLOCK_xxx macros that threw errors like "./const-c.inc:215:20:
error: '_CLOCK_REALTIME' is only available on macOS 10.12 or newer."
So I had a look at Apple's time.h and reconfigured like so:

$ ./Configure -Dusedevel -Accflags='-Werror=partial-availability'
-Accflags='-D_DARWIN_FEATURE_CLOCK_GETTIME=0' -des

That builds and passes all tests on Mojave.  I don't have a way to
prove that the Perl built this way will work on pre-Sierra macOS, but
for now the most plausible path forward looks like it would be adding
"-Werror=partial-availability -D_DARWIN_FEATURE_CLOCK_GETTIME=0" to
ccflags in darwin/hints.sh when MACOSX_DEPLOYMENT_TARGET <= 10.11.

Thread Previous


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