Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation failed on macOS 10.12.4 (Sierra) #43

Open
mezzomondo opened this issue Apr 27, 2017 · 3 comments
Open

Compilation failed on macOS 10.12.4 (Sierra) #43

mezzomondo opened this issue Apr 27, 2017 · 3 comments

Comments

@mezzomondo
Copy link

Hi,

I've got this error when compiling on OSX Sierra:

/tmp/erlang-czmq$ make
 APP    czmq.app.src
cd c_src; make
./build_czmq.sh
gcc -Wall -g2 -I/usr/local/Cellar/erlang/19.3/lib/erlang/lib/erl_interface-3.9.3/include -I/tmp/erlang-czmq/c_src/.libs/libsodium/include -I/tmp/erlang-czmq/c_src/.libs/libzmq/include -I/tmp/erlang-czmq/c_src/.libs/czmq/include -c czmq_benchmark.c -o czmq_benchmark.o
In file included from czmq_benchmark.c:41:
In file included from /tmp/erlang-czmq/c_src/.libs/czmq/include/czmq.h:19:
In file included from /tmp/erlang-czmq/c_src/.libs/czmq/include/czmq_prelude.h:210:
/usr/include/time.h:177:5: error: conflicting types for 'clock_gettime'
int clock_gettime(clockid_t __clock_id, struct timespec *__tp);
    ^
czmq_benchmark.c:26:5: note: previous definition is here
int clock_gettime(int clk_id, struct timespec *t){
    ^
1 error generated.
make[1]: *** [czmq_benchmark.o] Error 1
make: *** [app] Error 2

I tried some hacky solution but I think I'm stuck.

@gregerg
Copy link

gregerg commented Dec 6, 2018

hey @mezzomondo this is the patch we run to fix this. you basically have to delete the function in czmq_benchmark.c

--- a/deps/czmq/c_src/czmq_benchmark.c	2017-01-19 12:02:44.000000000 -0800
+++ b/deps/czmq/c_src/czmq_benchmark.c	2017-01-19 12:07:27.000000000 -0800
@@ -23,17 +23,6 @@
 #include <mach/mach_time.h>
 #define CLOCK_REALTIME 0
 #define CLOCK_MONOTONIC 0
-int clock_gettime(int clk_id, struct timespec *t){
-    mach_timebase_info_data_t timebase;
-    mach_timebase_info(&timebase);
-    uint64_t time;
-    time = mach_absolute_time();
-    double nseconds = ((double)time * (double)timebase.numer)/((double)timebase.denom);
-    double seconds = ((double)time * (double)timebase.numer)/((double)timebase.denom * 1e9);
-    t->tv_sec = seconds;
-    t->tv_nsec = nseconds;
-    return 0;
-}
 #else
 #include <time.h>
 #endif

@gar1t
Copy link
Owner

gar1t commented Dec 6, 2018

If this is generally applicable, could you submit it as a PR? I'll merge it!

@gregerg
Copy link

gregerg commented Dec 12, 2018

Unfortunately, I'm not sure whether it's generally applicable or not. It's possible it is only a problem on the OS X

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants