Bug #81137 [NEW]: Build failure on OS X 10.11 and earlier due to use of clock_gettime_nsec_np
| From: | php-bugs-2021 at ryandesign dot com | Date: | Mon, 14 Jun 2021 11:37:17 +0000 |
| Subject: | Bug #81137 [NEW]: Build failure on OS X 10.11 and earlier due to use of clock_gettime_nsec_np | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-234409@lists.php.net to get a copy of this message | ||
From: php-bugs-2021 at ryandesign dot com
Operating system: OS X 10.11.5
PHP version: 8.1.0alpha1
Package: Compile Failure
Bug Type: Bug
Bug description:Build failure on OS X 10.11 and earlier due to use of clock_gettime_nsec_np
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 bug report at https://bugs.php.net/bug.php?id=81137&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=81137&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=81137&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=81137&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=81137&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=81137&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=81137&r=support
Expected behavior: https://bugs.php.net/fix.php?id=81137&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=81137&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=81137&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=81137&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81137&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=81137&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=81137&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=81137&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=81137&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=81137&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=81137&r=mysqlcfg