Opened 4 years ago

Last modified 6 days ago

#61691 assigned enhancement

legacy-support: add clock_gettime_nsec_np and CLOCK_UPTIME_RAW

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: fhgwright (Fred Wright)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: snowflake (Dave Evans), mascguy (Christopher Nielsen)
Port: legacy-support, php-xdebug

Description

php-xdebug 3.0.0 fails to build on OS X 10.11 and earlier, even when legacysupport is used:

src/lib/timing.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_UPTIME_RAW);
               ^
src/lib/timing.c:111:31: error: use of undeclared identifier 'CLOCK_UPTIME_RAW'
        return clock_gettime_nsec_np(CLOCK_UPTIME_RAW);
                                     ^

Is adding support for clock_gettime_nsec_np and CLOCK_UPTIME_RAW feasible?

Change History (13)

comment:1 Changed 4 years ago by kencu (Ken)

As of OS X 10.12, the clock handling in darwin became more finely resolved. There is also an issue now building libcxx-11 (which is part of building clang-11) on < 10.12 due to this clock issue.

The libcxx source code had a fallback that was used until recently, when it was deleted here here.

To get newer clangs building on older systems we'll have to reinstate that fallback, and perhaps it might in the end be done in legacysupport... have to look at it closely to see how it fits in with what we already have there, and whether it might serve as the basis for this missing function.

comment:2 Changed 4 years ago by snowflake (Dave Evans)

Can I put in a request for these from sbcl?

runtime.c:401:5: warning: implicit declaration of function 'clock_gettime' is invalid in C99 [-Wimplicit-function-declaration]
    clock_gettime(
    ^
runtime.c:405:9: error: use of undeclared identifier 'CLOCK_MONOTONIC'
        CLOCK_MONOTONIC
        ^

comment:3 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: snowflake added

Dave, legacy support already implements clock_gettime and CLOCK_MONOTONIC.

comment:4 Changed 4 years ago by kencu (Ken)

making sbcl use legacysupport is hard, so I patched it instead...did I not push that patch yet? Silly me.

comment:6 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

In 4df3cf479782aef353d2e3ad44197679ad81cd0b/macports-ports (master):

php-xdebug: Remove legacy support portgroup

Remove legacy support portgroup which does not fix the build failure on
El Capitan and earlier.

See: #61691
See: #63350

comment:7 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

In 0ddb8ae2e33029bdaf936e3c0755693707dd1c4d/macports-ports (master):

php-xdebug: Downgrade to 2.9.8 for OS X <= 10.11

Downgrade to 2.9.8 for OS X 10.11 and earlier since xdebug 3 and later
use clock_gettime_nsec_np on macOS which is not in 10.11 or earlier nor
in legacy support.

See: #61691
See: #63350

comment:8 Changed 16 months ago by ryandesign (Ryan Carsten Schmidt)

Port: libbson added

libbson is now affected by this as well.

comment:9 Changed 16 months ago by ryandesign (Ryan Carsten Schmidt)

Port: libbson removed

Eh, only because their code is stupid. They also support clock_gettime so including legacysupport fixed it.

comment:10 Changed 4 months ago by mascguy (Christopher Nielsen)

Cc: mascguy fhgwright added

Fred, what are your thoughts on this?

comment:11 in reply to:  10 ; Changed 4 months ago by fhgwright (Fred Wright)

Replying to mascguy:

Fred, what are your thoughts on this?

Seems plausible in principle, though I haven't looked at the details yet. Feel free to assign it to me, though I don't want to worry about it for this release cycle. Given that it's a four-year old ticket, I don't imagine there's a rush. :-)

I was planning to review old tickets at some point. There's also one PR that's almost two years old, and may or may not still be relevant.

BTW, in spite of what's claimed in the "their code is stupid" link, clock_gettime wasn't introduced until 10.12.

Last edited 4 months ago by fhgwright (Fred Wright) (previous) (diff)

comment:12 in reply to:  11 ; Changed 6 days ago by mascguy (Christopher Nielsen)

Cc: fhgwright removed
Owner: set to fhgwright
Status: newassigned

Replying to fhgwright:

Replying to mascguy:

Fred, what are your thoughts on this?

Seems plausible in principle, though I haven't looked at the details yet. Feel free to assign it to me, though I don't want to worry about it for this release cycle.

Support for this would definitely be useful, as we need it for new port mozjs128:

mozjs128/work/mozjs-128.1.0/mozglue/misc/AwakeTimeStamp.cpp:64:25: error: use of undeclared identifier 'clock_gettime_nsec_np'

comment:13 in reply to:  12 Changed 6 days ago by fhgwright (Fred Wright)

Replying to mascguy:

Replying to fhgwright:

Replying to mascguy:

Fred, what are your thoughts on this?

Seems plausible in principle, though I haven't looked at the details yet. Feel free to assign it to me, though I don't want to worry about it for this release cycle.

Support for this would definitely be useful, as we need it for new port mozjs128:

mozjs128/work/mozjs-128.1.0/mozglue/misc/AwakeTimeStamp.cpp:64:25: error: use of undeclared identifier 'clock_gettime_nsec_np'

My intent, after finishing some mostly "cleanup" changes, is to review the open tickets (and PR) to see which might be straightforward enough to include in this release cycle. One problem with anything clock-related is that it's hard to write an automated test for something that's a moving target, and the existing clock test is mainly just a manual test masquerading as an automated test, requiring manual scrutiny of the output for validity. At least the rewritten version no longer treats out-and-out failures of the functions being tested as a "pass" (exposing one real bug in the process). :-)

Note: See TracTickets for help on using tickets.