#64597 closed defect (fixed)
libusb @ 1.0.25: error: use of undeclared identifier 'CLOCK_MONOTONIC'; error: 'TARGET_OS_OSX' is not defined, evaluates to 0; 'clock_gettime' is invalid in C99
Reported by: | thetrial (alabay) | Owned by: | michaelld (Michael Dickens) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.7.1 |
Keywords: | elcapitan legacy-os | Cc: | |
Port: | libusb |
Description
Something goes wrong. Happened on two machines with El Capitan.
:info:build os/darwin_usb.c:1804:3: error: implicit declaration of function 'clock_gettime' is invalid in C99 [-Werror,-Wimplicit-function-declaration] :info:build clock_gettime(CLOCK_MONOTONIC, &start); :info:build ^ :info:build os/darwin_usb.c:1804:3: note: did you mean 'clock_get_time'? :info:build /usr/include/mach/clock.h:52:15: note: 'clock_get_time' declared here :info:build kern_return_t clock_get_time :info:build ^ :info:build os/darwin_usb.c:1804:17: error: use of undeclared identifier 'CLOCK_MONOTONIC' :info:build clock_gettime(CLOCK_MONOTONIC, &start); :info:build ^ :info:build os/darwin_usb.c:1811:19: error: use of undeclared identifier 'CLOCK_MONOTONIC' :info:build clock_gettime(CLOCK_MONOTONIC, &now); :info:build ^ :info:build os/darwin_usb.c:2420:5: error: 'TARGET_OS_OSX' is not defined, evaluates to 0 [-Werror,-Wundef] :info:build #if TARGET_OS_OSX :info:build ^ :info:build 4 errors generated.
Attachments (2)
Change History (7)
Changed 3 years ago by thetrial (alabay)
comment:1 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)
comment:2 Changed 3 years ago by RobK88
FYI -- I am also unable to build libusb @ 1.0.25 on Lion. Use of undeclared identifier 'CLOCK_MONOTONIC'. But I do NOT see the other error -- "error: 'TARGET_OS_OSX' is not defined".
See attached main.log
comment:3 Changed 3 years ago by kencu (Ken)
already fixed by using legacysupport
[e342fc5e7afbf63654b308cd816ab120a8c018ad/macports-ports]
sync your ports and give it another try pls
comment:4 Changed 3 years ago by RobK88
Thanks Ken! I am now able to build and install libusb @ 1.0.25 on Lion.
comment:5 Changed 3 years ago by michaelld (Michael Dickens)
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Note: See
TracTickets for help on using
tickets.
Replying to thetrial:
clock_gettime
andCLOCK_MONOTONIC
are new as of macOS 10.12. If libusb requires them, and if the developers will not provide compatibility implementations for older systems that do not have them, then the port can include the legacysupport portgroup to use our implementations of them. (The portfile already includes legacysupport conditionally in the libusb-devel subport.)We recently switched MacPorts to use a newer clang compiler on older systems. This newer clang happens to introduce this new error. When I've encountered this error before, the correct fix was for that source file to
#include <TargetConditionals.h>
(which is where theTARGET_OS_*
constants get defined).