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

Install error: implicit declaration of function 'clock_gettime' is invalid in C99 #133

Closed
OADesigns opened this issue Oct 30, 2021 · 4 comments · Fixed by #135
Closed

Install error: implicit declaration of function 'clock_gettime' is invalid in C99 #133

OADesigns opened this issue Oct 30, 2021 · 4 comments · Fixed by #135

Comments

@OADesigns
Copy link

I don't really know any C but am trying to install node-datachannel, and it uses libdatachannel and this, libjuice, as a dependency. This is on an older macOS, 10.10 I'm using as a test server.
I'm using npm run build and the error stops the build and the exact error is:

[ 2%] Building C object _deps/libdatachannel-build/deps/libjuice/CMakeFiles/juice-static.dir/src/random.c.o
/Users/testserver/Desktop/node-datachannel/build/_deps/libdatachannel-src/deps/libjuice/src/random.c:75:6: warning: implicit declaration of function 'clock_gettime' is invalid in C99
[-Wimplicit-function-declaration]
if (clock_gettime(CLOCK_REALTIME, &ts) == 0)
^
/Users/testserver/Desktop/node-datachannel/build/_deps/libdatachannel-src/deps/libjuice/src/random.c:75:20: error: use of undeclared identifier 'CLOCK_REALTIME'
if (clock_gettime(CLOCK_REALTIME, &ts) == 0)
^
1 warning and 1 error generated.
make[2]: *** [_deps/libdatachannel-build/deps/libjuice/CMakeFiles/juice-static.dir/src/random.c.o] Error 1
make[1]: *** [_deps/libdatachannel-build/deps/libjuice/CMakeFiles/juice-static.dir/all] Error 2
make: *** [all] Error 2
ERR! OMG Process terminated: 2

Am I doing something wrong? Any help or a workaround would be a life saver right now as I have no idea what to do.

@paullouisageneau
Copy link
Owner

paullouisageneau commented Oct 31, 2021

The issue comes from macOS 10.10 which lacks the actual function, you need at least macOS 10.12. MacOS 10.10 is very old (it hasn't received security updates for a couple years now), is there a reason to use it?

@paullouisageneau
Copy link
Owner

I added a quick workaround: #135

@paullouisageneau
Copy link
Owner

The fix is released in libjuice v0.9.3, to check it works with node-datachannel you'll need to change GIT_TAG to v0.15 or master here: https://github.com/murat-dogan/node-datachannel/blob/b6ce3bc90903be3160c4188bd094df8bfffe2e0e/CMakeLists.txt#L30

@OADesigns
Copy link
Author

Yes I was using 10.10 because it runs on an older machine that starts to slow down whenever I update it. I appreciate you taking the time to create the workaround and will give it a try and let you know.If I still have issues I will probably have to find something that will install linux as I imagine it would give less headaches. Thank you again.

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

Successfully merging a pull request may close this issue.

2 participants