|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2021-06-14 11:37 UTC] 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.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 03:00:02 2025 UTC |
Thanks. As a result of this change, php81 is now available in MacPorts at least as far back as Mac OS X 10.6 ("Snow Leopard"), like previous php versions were. I find it valuable to have php available on as many systems as possible, including older ones. There are still plenty of Macs in service that are too old to be updated to macOS 10.12 or newer. Scripting languages like php can be an important component in repurposing older machines for a second life. There may also be students who only have access to such older computers but who still want to learn php. While it is only a small sample size, among those MacPorts users who have php 8.0.x installed and chose to submit usage statistics in the past 30 days, 44% of them were running OS X versions earlier than 10.12. https://ports.macports.org/port/php80/stats?days=30&days_ago=0