Bug #81137 [Csd]: Build failure on OS X 10.11 and earlier due to use of clock_gettime_nsec_np

From: Date: Mon, 14 Jun 2021 16:27:52 +0000
Subject: Bug #81137 [Csd]: 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-234414@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 User updated by: php-bugs-2021 at ryandesign dot com 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: Closed Type: Bug Package: Compile Failure Operating System: OS X 10.11.5 PHP Version: 8.1.0alpha1 Assigned To: krakjoe Block user comment: N Private report: N New Comment: 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 Previous Comments: ------------------------------------------------------------------------ [2021-06-14 12:28:44] krakjoe@php.net The fix for this bug has been committed. If you are still experiencing this bug, try to check out latest source from https://github.com/php/php-src and re-test. Thank you for the report, and for helping us make PHP better. Fixed in 72c0deb4009e1ddfdccd2b353e0a839ffe10d81a ------------------------------------------------------------------------ [2021-06-14 11:41:03] cmb@php.net See the discussion on <https://github.com/php/php-src/pull/6609>. ------------------------------------------------------------------------ [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

« previous php.bugs (#234414) next »