hnes / libaco

A blazing fast and lightweight C asymmetric coroutine library 💎 ⛅🚀⛅🌞
https://libaco.org
Apache License 2.0
3.51k stars 391 forks source link

Fail to build libaco #18

Closed xiaozongyang closed 6 years ago

xiaozongyang commented 6 years ago

When I build the project libaco by executing command bash make.sh -o no-m32 -o no-valgrind I got the error

test_aco_benchmark.c:106:17: error: implicit declaration of function 'clock_gettime' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
    assert(0 == clock_gettime(CLOCK_MONOTONIC, &tstart));
test_aco_benchmark.c:168:31: error: use of undeclared identifier 'CLOCK_MONOTONIC'
    assert(0 == clock_gettime(CLOCK_MONOTONIC, &tstart));

And here is my envonment:

Did I missing any key point?

hnes commented 6 years ago

Thank you very much for your report, @XiaoZYang ;-)

Actually, it is a known issue:

In effect, clock_gettime seems not to be implemented for macOS before Sierra 10.12.

-- from this link

I would add such compliant support for "macOS before Sierra 10.12" as soon as I get enough spare time. Maybe you could choose to write your own patch (or just choose another platform like linux to build the benchmark) before that and PR is always welcome :D

PS:

The clock_gettime now is only required by the benchmark file test_aco_benchmark.c.

xiaozongyang commented 6 years ago

@hnes thanks for your explaining. I will try to build on Linux later.