caryll / otfcc

Optimized OpenType builder and inspector.
Apache License 2.0
422 stars 63 forks source link

clock_gettime not available on OS X #3

Closed anthrotype closed 8 years ago

anthrotype commented 8 years ago

Hi, and thanks for working on this!

I tried to compile it on my mac, but it seems like the function clock_gettime is not available on that platform. This is what I get from make:

$ make all
clang -O3 -Wall -c otfccdump.c -o build/otfccdump.o
otfccdump.c:87:2: warning: implicit declaration of function 'clock_gettime' is invalid in C99 [-Wimplicit-function-declaration]
        clock_gettime(CLOCK_REALTIME, &ends);
        ^
otfccdump.c:87:16: error: use of undeclared identifier 'CLOCK_REALTIME'
        clock_gettime(CLOCK_REALTIME, &ends);
                      ^
otfccdump.c:96:16: error: use of undeclared identifier 'CLOCK_REALTIME'
        clock_gettime(CLOCK_REALTIME, &begin);
                      ^
1 warning and 2 errors generated.
make: *** [build/otfccdump.o] Error 1

Here a link where they discuss about alternatives to clock_gettime for OS X: http://stackoverflow.com/questions/5167269/clock-gettime-alternative-in-mac-os-x

Thanks.

Cosimo

be5invis commented 8 years ago

@anthrotype I added another polyfill for OSX in the latest version. Does this one work? I do not have an OSX machine so I can not test it.

anthrotype commented 8 years ago

I don't know if that works, as I still haven't figured out how to compile it past the clock_gettime issue above...

If you don't have an OS X machine available, maybe you could setup Travis CI with a OS X build environment, or test on both OS X and Linux in multi-os mode.

be5invis commented 8 years ago

@anthrotype The latest commit contains a polyfill which removes the clock_gettime requirement under OSX. You should pull it and rebuild, and it should compile as expected.

anthrotype commented 8 years ago

oh, ok. I'll try that!

anthrotype commented 8 years ago

I don't know what you mean by "polyfill" but yes, it compiles now. I guess this issue can be closed now. thanks!

be5invis commented 8 years ago

@anthrotype Currently otfcc is still under construction. Tests, bug reports and PRs are welcome :)