pantoniou / libfyaml

Fully feature complete YAML parser and emitter, supporting the latest YAML spec and passing the full YAML testsuite.
MIT License
239 stars 73 forks source link

cannot compile v0.9 on macOS #100

Closed MarDiehl closed 10 months ago

MarDiehl commented 10 months ago

Updating the Conda package for macOS (Intel) fails due to missing CLOCK_MONOTONIC (and undefined clock_gettime). It runs on macOS 11.7.10, so according to https://stackoverflow.com/questions/5167269/, it should be available.

2023-09-25T15:52:11.3088370Z   CC    internal/fy_thread-fy-thread.o
2023-09-25T15:52:11.4318500Z internal/fy-thread.c:190:2: warning: call to undeclared function 'clock_gettime'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
2023-09-25T15:52:11.4320030Z         clock_gettime(CLOCK_MONOTONIC, &s->execute);
2023-09-25T15:52:11.4320900Z         ^
2023-09-25T15:52:11.4329150Z internal/fy-thread.c:190:16: error: use of undeclared identifier 'CLOCK_MONOTONIC'
2023-09-25T15:52:11.4330310Z         clock_gettime(CLOCK_MONOTONIC, &s->execute);
2023-09-25T15:52:11.4330730Z                       ^
2023-09-25T15:52:11.4336880Z internal/fy-thread.c:232:3: warning: call to undeclared function 'clock_gettime'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
2023-09-25T15:52:11.4337890Z                 clock_gettime(CLOCK_MONOTONIC, &s->reserve);
2023-09-25T15:52:11.4338280Z                 ^
2023-09-25T15:52:11.4348520Z internal/fy-thread.c:232:17: error: use of undeclared identifier 'CLOCK_MONOTONIC'
2023-09-25T15:52:11.4349510Z                 clock_gettime(CLOCK_MONOTONIC, &s->reserve);
2023-09-25T15:52:11.4350030Z                               ^
2023-09-25T15:52:11.4360740Z internal/fy-thread.c:239:17: error: use of undeclared identifier 'CLOCK_MONOTONIC'
2023-09-25T15:52:11.4361980Z                 clock_gettime(CLOCK_MONOTONIC, &s->reserve_done);
2023-09-25T15:52:11.4362640Z                               ^
2023-09-25T15:52:11.4363350Z internal/fy-thread.c:245:3: warning: call to undeclared function 'clock_gettime'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
2023-09-25T15:52:11.4363970Z                 clock_gettime(CLOCK_MONOTONIC, &s->submit);
2023-09-25T15:52:11.4364430Z                 ^
2023-09-25T15:52:11.4372790Z internal/fy-thread.c:245:17: error: use of undeclared identifier 'CLOCK_MONOTONIC'
2023-09-25T15:52:11.4373840Z                 clock_gettime(CLOCK_MONOTONIC, &s->submit);
2023-09-25T15:52:11.4374230Z                               ^
2023-09-25T15:52:11.4375880Z internal/fy-thread.c:255:3: warning: call to undeclared function 'clock_gettime'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
2023-09-25T15:52:11.4376660Z                 clock_gettime(CLOCK_MONOTONIC, &s->wait);
2023-09-25T15:52:11.4377070Z                 ^
2023-09-25T15:52:11.4386110Z internal/fy-thread.c:255:17: error: use of undeclared identifier 'CLOCK_MONOTONIC'
2023-09-25T15:52:11.4387090Z                 clock_gettime(CLOCK_MONOTONIC, &s->wait);
2023-09-25T15:52:11.4387440Z                               ^
2023-09-25T15:52:11.4397570Z internal/fy-thread.c:260:17: error: use of undeclared identifier 'CLOCK_MONOTONIC'
2023-09-25T15:52:11.4398790Z                 clock_gettime(CLOCK_MONOTONIC, &s->wait_done);
2023-09-25T15:52:11.4399150Z                               ^
2023-09-25T15:52:11.4399760Z internal/fy-thread.c:266:3: warning: call to undeclared function 'clock_gettime'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
2023-09-25T15:52:11.4401020Z                 clock_gettime(CLOCK_MONOTONIC, &s->unreserve);
2023-09-25T15:52:11.4401430Z                 ^
2023-09-25T15:52:11.4412050Z internal/fy-thread.c:266:17: error: use of undeclared identifier 'CLOCK_MONOTONIC'
2023-09-25T15:52:11.4413930Z                 clock_gettime(CLOCK_MONOTONIC, &s->unreserve);
2023-09-25T15:52:11.4414970Z                               ^
2023-09-25T15:52:11.4426790Z internal/fy-thread.c:271:17: error: use of undeclared identifier 'CLOCK_MONOTONIC'
2023-09-25T15:52:11.4427340Z                 clock_gettime(CLOCK_MONOTONIC, &s->unreserve_done);
2023-09-25T15:52:11.4429510Z                               ^
2023-09-25T15:52:11.4452990Z internal/fy-thread.c:435:2: warning: call to undeclared function 'clock_gettime'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
2023-09-25T15:52:11.4454070Z         clock_gettime(CLOCK_MONOTONIC, &before);
2023-09-25T15:52:11.4454410Z         ^
2023-09-25T15:52:11.4464610Z internal/fy-thread.c:435:16: error: use of undeclared identifier 'CLOCK_MONOTONIC'
2023-09-25T15:52:11.4465640Z         clock_gettime(CLOCK_MONOTONIC, &before);
2023-09-25T15:52:11.4466000Z                       ^
2023-09-25T15:52:11.4481010Z internal/fy-thread.c:439:16: error: use of undeclared identifier 'CLOCK_MONOTONIC'
2023-09-25T15:52:11.4481480Z         clock_gettime(CLOCK_MONOTONIC, &after);
2023-09-25T15:52:11.4481910Z                       ^
2023-09-25T15:52:11.4493380Z internal/fy-thread.c:442:16: error: use of undeclared identifier 'CLOCK_MONOTONIC'
2023-09-25T15:52:11.4494530Z         clock_gettime(CLOCK_MONOTONIC, &before);
2023-09-25T15:52:11.4494880Z                       ^
2023-09-25T15:52:11.4504860Z internal/fy-thread.c:444:16: error: use of undeclared identifier 'CLOCK_MONOTONIC'
2023-09-25T15:52:11.4505740Z         clock_gettime(CLOCK_MONOTONIC, &after);
2023-09-25T15:52:11.4506330Z                       ^
2023-09-25T15:52:11.4520190Z internal/fy-thread.c:465:17: error: use of undeclared identifier 'CLOCK_MONOTONIC'
2023-09-25T15:52:11.4521040Z                 clock_gettime(CLOCK_MONOTONIC, &before);
2023-09-25T15:52:11.4521810Z                               ^
2023-09-25T15:52:11.4536490Z internal/fy-thread.c:492:17: error: use of undeclared identifier 'CLOCK_MONOTONIC'
2023-09-25T15:52:11.4544970Z                 clock_gettime(CLOCK_MONOTONIC, &after);
2023-09-25T15:52:11.4545350Z  
pantoniou commented 10 months ago

I'm not sure what the issue is. The one mac-os host that I have available seems to compile it just fine (using a homebrew installtion).

I'm on a somewhat older version though (10.13).

What's the environment the build fails?

pantoniou commented 10 months ago

https://github.com/pocoproject/poco/issues/1453

Seems like clock_gettime is not available on some old? versions of MacOSX.

Although I'm on an older version, I've updated recently and the support is available.

From man clock_gettime() on my mac box.

"These functions first appeared in Mac OSX 10.12"

MarDiehl commented 10 months ago

It's a recent macOS version (11.7.10), but build with -mmacosx-version-min=10.9. That explains it.

For the conda package, I simply patch away the code for the timing tests