Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failure on OS X 10.12 Sierra #15524

Closed
p5pRT opened this issue Aug 17, 2016 · 18 comments
Closed

Build failure on OS X 10.12 Sierra #15524

p5pRT opened this issue Aug 17, 2016 · 18 comments
Labels

Comments

@p5pRT
Copy link
Collaborator

@p5pRT p5pRT commented Aug 17, 2016

Migrated from rt.perl.org#128972 (status was 'resolved')

Searchable as RT128972$

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Aug 17, 2016

From mojca.miklavec.lists@gmail.com

Perl fails to build on OS X 10.12 (both 5.22 and 5.24 are affected, earlier and later versions were not tested yet)​:

HiRes.xs​:945​:15​: error​: use of undeclared identifier 'darwin_time_mutex'
  MUTEX_INIT(&darwin_time_mutex);
  ^
1 error generated.

See the following links (patch included)​:
  * https://trac.macports.org/ticket/52012
  * Homebrew/homebrew-core#1957 (comment)
  * https://raw.githubusercontent.com/Homebrew/formula-patches/4455ab37423c123b2e4bd334ad48812ecf2f9109/perl/clock_gettime.patch

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Aug 18, 2016

From @tonycoz

On Wed Aug 17 05​:46​:44 2016, mojca.miklavec.lists@​gmail.com wrote​:

Perl fails to build on OS X 10.12 (both 5.22 and 5.24 are affected,
earlier and later versions were not tested yet)​:

HiRes.xs​:945​:15​: error​: use of undeclared identifier
'darwin_time_mutex'
MUTEX_INIT(&darwin_time_mutex);
^
1 error generated.

See the following links (patch included)​:
* https://trac.macports.org/ticket/52012
* https://github.com/Homebrew/homebrew-
core/issues/1957#issuecomment-226848462
* https://raw.githubusercontent.com/Homebrew/formula-
patches/4455ab37423c123b2e4bd334ad48812ecf2f9109/perl/clock_gettime.patch

This is fixed in blead, it may need a backport to 5.24/5.22.

Tony

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Aug 18, 2016

The RT System itself - Status changed from 'new' to 'open'

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Aug 18, 2016

From mojca@macports.org

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.

Mojca

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Sep 15, 2016

From @craigberry

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.

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Jul 28, 2017

From @steve-m-hay

Note​: Backporting a newer Time​::HiRes for 5.24.3 is under discussion in https://rt-archive.perl.org/perl5/Ticket/Display.html?id=128427.

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Oct 1, 2018

From @jkeenan

5.24 is out of support, so, nothwithstanding one dependency listing still open, this ticket is closable. Marking resolved.
--
James E Keenan (jkeenan@​cpan.org)

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Oct 1, 2018

@jkeenan - Status changed from 'open' to 'resolved'

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Oct 1, 2018

From @jkeenan

On Mon, 01 Oct 2018 10​:55​:00 GMT, jkeenan wrote​:

5.24 is out of support, so, nothwithstanding one dependency listing
still open, this ticket is closable. Marking resolved.

I resolved the wrong ticket; re-opening.

Thank you very much.
--
James E Keenan (jkeenan@​cpan.org)

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Oct 1, 2018

@jkeenan - Status changed from 'resolved' to 'open'

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Mar 29, 2019

From @khwilliamson

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?
--
Karl Williamson

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented Apr 28, 2019

From @craigberry

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.

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented May 3, 2019

From @khwilliamson

I have worked up a patch based on Craig's ideas (attached). I have run this on Darwin 17.0, and it works, but it also works without the patch and setting the deployment target to 10.10. So, I don't know how to make sure the problem exists and that this solves it
--
Karl Williamson

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented May 3, 2019

From @khwilliamson

0001-PATCH-perl-128972-Build-failure-on-OS-X.patch
From 1cfa8a0c107fb5aaa0c951592265b137274143b9 Mon Sep 17 00:00:00 2001
From: Karl Williamson <khw@cpan.org>
Date: Fri, 3 May 2019 12:13:51 -0600
Subject: [PATCH] PATCH: [perl #128972] Build failure on OS X

---
 hints/darwin.sh | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/hints/darwin.sh b/hints/darwin.sh
index feb15f6b4f..53650d26cb 100644
--- a/hints/darwin.sh
+++ b/hints/darwin.sh
@@ -273,19 +273,24 @@ add_macosx_version_min () {
   esac
 }
 
+time_hires_early_ccflags="-Werror=partial-availability -D_DARWIN_FEATURE_CLOCK_GETTIME=0"
+
 # Perl bundles do not expect two-level namespace, added in Darwin 1.4.
 # But starting from perl 5.8.1/Darwin 7 the default is the two-level.
 case "$osvers" in  # Note: osvers is the kernel version, not the 10.x
 1.[0-3].*) # OS X 10.0.x
    lddlflags="${ldflags} -bundle -undefined suppress"
+   ccflags="$ccflags $time_hires_early_ccflags"
    ;;
 1.*)       # OS X 10.1
    ldflags="${ldflags} -flat_namespace"
    lddlflags="${ldflags} -bundle -undefined suppress"
+   ccflags="$ccflags $time_hires_early_ccflags"
    ;;
 [2-6].*)   # OS X 10.1.x - 10.2.x (though [2-4] never existed publicly)
    ldflags="${ldflags} -flat_namespace"
    lddlflags="${ldflags} -bundle -undefined suppress"
+   ccflags="$ccflags $time_hires_early_ccflags"
    ;;
 [7-9].*)   # OS X 10.3.x - 10.5.x
    lddlflags="${ldflags} -bundle -undefined dynamic_lookup"
@@ -293,6 +298,7 @@ case "$osvers" in  # Note: osvers is the kernel version, not the 10.x
        *MACOSX_DEPLOYMENT_TARGET*) ;;
        *) ld="env MACOSX_DEPLOYMENT_TARGET=10.3 ${ld}" ;;
    esac
+   ccflags="$ccflags $time_hires_early_ccflags"
    ;;
 *)        # OS X 10.6.x - current
    # The MACOSX_DEPLOYMENT_TARGET is not needed,
@@ -304,6 +310,14 @@ case "$osvers" in  # Note: osvers is the kernel version, not the 10.x
     10.*)
       add_macosx_version_min ccflags $MACOSX_DEPLOYMENT_TARGET
       add_macosx_version_min ldflags $MACOSX_DEPLOYMENT_TARGET
+
+      case "$MACOSX_DEPLOYMENT_TARGET" in
+        10.[6-9]|10.10|10.11)
+        ccflags="$ccflags $time_hires_early_ccflags"
+        ;;
+      *)
+        ;;
+      esac
       ;;
     '')
       # Empty MACOSX_DEPLOYMENT_TARGET is okay.
-- 
2.17.1

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented May 9, 2019

From @khwilliamson

There have been problems lately with either or both the RT system and/or email not working properly, including some responses that should have gotten associated with this ticket. Let's hope this one works.

Craig Berry took my patch and found some issues with it, and submitted an alternate one, which I have now pushed to blead as

commit 1a833e4
Author​: Craig A. Berry <craigberry@​mac.com>
Date​: Fri May 3 16​:45​:41 2019 -0500

  Hide clock_gettime() from macOS 10.12+ for pre-10.12.
 
  When building on current Darwin but deploying to macOS 10.11.x or
  earlier, we need to convince Time​::HiRes to use its override of
  clock_gettime() rather than the system-supplied one.
 
  Addresses [perl #128972].
--
Karl Williamson

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented May 9, 2019

@khwilliamson - Status changed from 'open' to 'pending release'

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented May 22, 2019

From @khwilliamson

Thank you for filing this report. You have helped make Perl better.

With the release today of Perl 5.30.0, this and 160 other issues have been
resolved.

Perl 5.30.0 may be downloaded via​:
https://metacpan.org/release/XSAWYERX/perl-5.30.0

If you find that the problem persists, feel free to reopen this ticket.

@p5pRT

This comment has been minimized.

Copy link
Collaborator Author

@p5pRT p5pRT commented May 22, 2019

@khwilliamson - Status changed from 'pending release' to 'resolved'

@p5pRT p5pRT closed this May 22, 2019
@p5pRT p5pRT added the Severity Low label Oct 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.