Bug #81137 [Opn]: Build failure on OS X 10.11 and earlier due to use of clock_gettime_nsec_np
| From: | cmb@php.net | Date: | Mon, 14 Jun 2021 11:41:03 +0000 |
| Subject: | Bug #81137 [Opn]: Build failure on OS X 10.11 and earlier due to use of clock_gettime_nsec_np | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-234411@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=81137&edit=1
ID: 81137
Updated by: cmb@php.net
Reported by: php-bugs-2021 at ryandesign dot com
Summary: Build failure on OS X 10.11 and earlier due to use
of clock_gettime_nsec_np
Status: Open
Type: Bug
Package: Compile Failure
Operating System: OS X 10.11.5
PHP Version: 8.1.0alpha1
Block user comment: N
Private report: N
New Comment:
See the discussion on <https://github.com/php/php-src/pull/6609>.
Previous Comments:
------------------------------------------------------------------------
[2021-06-14 11:40:54] rtrtrtrtrt at dfdfdfdf dot dfd35
> Looks like this problem was caused in php commit
> a3e55286a676fdf4f5919d219e2a0df93f817211
> "Using a more modern and simpler api available since Sierra (2016)
and why can one not update to a newer OS 5 years later or use PHP8.0 on old OS?
------------------------------------------------------------------------
[2021-06-14 11:37:17] php-bugs-2021 at ryandesign dot com
Description:
------------
Hi, php 8.1.0alpha1 does not build on OS X 10.11 ("El Capitan") and earlier because of:
/path/to/php-8.1.0alpha1/ext/standard/hrtime.c:111:9: warning: implicit declaration of function
'clock_gettime_nsec_np' is invalid in C99 [-Wimplicit-function-declaration]
return clock_gettime_nsec_np(CLOCK_MONOTONIC_RAW);
^
/path/to/php-8.1.0alpha1/ext/standard/hrtime.c:111:31: error: use of undeclared identifier
'CLOCK_MONOTONIC_RAW'
return clock_gettime_nsec_np(CLOCK_MONOTONIC_RAW);
^
1 warning and 1 error generated.
make: *** [ext/standard/hrtime.lo] Error 1
Here's a full build log if you would like it:
https://build.macports.org/builders/ports-10.11_x86_64-builder/builds/144512/steps/install-port/logs/stdio
php 8.0.x and earlier were able to build on these older OS X versions.
clock_gettime and related functions were not in the operating system prior to macOS 10.12
("Sierra").
In php 8.0.x, I already noticed a similar problem with just the opcache extension and I applied a
workaround in MacPorts that adds a compatibility implementation of these functions via the MacPorts
"legacy support" library. Here's our implementation:
https://github.com/macports/macports-legacy-support/blob/master/include/time.h
https://github.com/macports/macports-legacy-support/blob/master/src/time.c
But now in php 8.1.x the build failure affects php as a whole.
We don't have a compatibility implementation of clock_gettime_nsec_np in MacPorts legacy
support yet (https://trac.macports.org/ticket/61691) so we are not able to work around it by adding
our library here.
Looks like this problem was caused in php commit a3e55286a676fdf4f5919d219e2a0df93f817211
("Using a more modern and simpler api available since Sierra (2016).")
Since you had an apparently working implementation before, perhaps you can have a configure test
that checks for clock_gettime, uses it if available, and otherwise uses the older implementation.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81137&edit=1