[MacPorts] #63350: php80-xdebug: error: use of undeclared identifier 'CLOCK_UPTIME_RAW' (was: Xdebug not building on El Capitan)

MacPorts noreply at macports.org
Thu Aug 12 06:58:36 UTC 2021


#63350: php80-xdebug: error: use of undeclared identifier 'CLOCK_UPTIME_RAW'
-------------------------+------------------------
  Reporter:  mav2287     |      Owner:  ryandesign
      Type:  defect      |     Status:  accepted
  Priority:  Normal      |  Milestone:
 Component:  ports       |    Version:
Resolution:              |   Keywords:
      Port:  php-xdebug  |
-------------------------+------------------------
Changes (by ryandesign):

 * status:  assigned => accepted
 * keywords:  PHP Xdebug =>
 * port:  php80-xdebug => php-xdebug


Comment:

 I've [https://bugs.xdebug.org/view.php?id=2007 reported this problem to
 the developers of xdebug].

 On macOS, xdebug 3 and later unconditionally uses `clock_gettime_nsec_np`
 but this function, together with `clock_gettime` and related constants, is
 only in macOS 10.12 and later, therefore the port cannot build on earlier
 versions of macOS.

 MacPorts has a legacy support library which contains implementations of
 several newer functions such as `clock_gettime` that are not in older
 operating systems. I [changeset:fbc2419ce8a903048b1931535cc6cd9793007baf
 /macports-ports added legacy support to this port] in an attempt to fix
 this, but it didn't work because we don't have an implementation of
 `clock_gettime_nsec_np` there yet. I [ticket:61691 requested the addition
 of this function] to legacy support but it has not yet been done. If you
 or anyone would like to assist in adding an implementation of this
 function to our legacy support library that would be welcome and would
 help further our ability to support newer software on older operating
 systems.

 In fact xdebug already contains several codepaths in this area, one of
 which (for Linux) uses `clock_gettime`, so we could perhaps use that
 codepath together with our legacy support instead of their
 `clock_gettime_nsec_np` Mac codepath to fix this problem in MacPorts, but
 an upstream solution that works for all users, not just MacPorts users, is
 preferable.

 It even looks like this entire functionality within xdebug is optional. On
 Linux versions without `clock_gettime`, it looks like no error should
 occur. So that may be another solution. I don't know how xdebug uses these
 functions so it would be up to them to decide the best solution.

 xdebug's code is:

 {{{
 // Mac
 // should be fast but can be relative
 #elif __APPLE__
 static uint64_t xdebug_get_nanotime_rel(xdebug_nanotime_context
 *nanotime_context)
 {
         return clock_gettime_nsec_np(CLOCK_UPTIME_RAW);
 }

 // Linux/Unix with clock_gettime
 #elif defined(CLOCK_MONOTONIC)
 static uint64_t xdebug_get_nanotime_rel(xdebug_nanotime_context
 *nanotime_context)
 {
         struct timespec ts;

         if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
                 return (uint64_t)ts.tv_sec * NANOS_IN_SEC +
 (uint64_t)ts.tv_nsec;
         }

         return 0;
 }
 #endif
 }}}

-- 
Ticket URL: <https://trac.macports.org/ticket/63350#comment:4>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list