michaelforney / samurai

ninja-compatible build tool written in C

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

build error on Mac

tfarina opened this issue · comments

cc -std=c99 -Wall -Wextra -Wpedantic -c -o build.o build.c
build.c:231:8: warning: implicit declaration of function 'clock_gettime' is
invalid in C99 [-Wimplicit-function-declaration]
if (clock_gettime(CLOCK_MONOTONIC, &endtime) != 0) {
^
build.c:231:22: error: use of undeclared identifier 'CLOCK_MONOTONIC'
if (clock_gettime(CLOCK_MONOTONIC, &endtime) != 0) {
^
build.c:515:16: error: use of undeclared identifier 'CLOCK_MONOTONIC'
clock_gettime(CLOCK_MONOTONIC, &starttime);
^
1 warning and 2 errors generated.
make: *** [build.o] Error 1

Sorry for the delay, I missed this issue.

samurai requires POSIX.1-2008 interfaces. You might need to set some feature test macros to get macOS to define the right functions.

The macOS continuous build does not show any problems (https://github.com/michaelforney/samurai/runs/648727481), so I'm not sure exactly why they are showing up on your system.

commented

iirc macos 10.12 is when it got clock_gettime, so if your macos version is below that you'll need to update.

Ah, thanks for the info. @tfarina are you on an older version than 10.12?

Yeah, sorry about that. I didn't know the version requirement.