llama.cpp
llama.cpp copied to clipboard
fix: add POSIX functionality for Linux compilation
Small fix to compile binaries properly on Linux:
- defines
CLOCK_MONOTONIC
inggml.c
- Closes #54
Can you add a short comment why this is required? (I assume some functions are not recognized but not obvious which ones)
Sure!
Sure!
I meant into the source code just above the #define
Btw the issue #54 mentions _POSIX_C_SOURCE=199309L
; why did you chose newer standard and thus less compatibility?
Small fix to compile binaries properly on Linux:
Which OS and which GCC version do you use?
For me the master compiles just fine on Debian 11 with GCC 10.2.1 (even without the proposed define).
CentOS7 with GCC 10.2.0
This flags has been discussed in whisper.cpp
too and I still don't know when it should be added and when not.
Hopefully someone can clarify.
https://github.com/ggerganov/whisper.cpp/issues/37 https://github.com/ggerganov/whisper.cpp/pull/576
Now thinking more about this, probably the cleanest option is to add compilation flags to the build system like suggested in https://github.com/ggerganov/whisper.cpp/issues/37 + https://github.com/ggerganov/whisper.cpp/pull/576
CFLAGS += -D_POSIX_SOURCE -D_GNU_SOURCE
CXXFLAGS += -D_POSIX_SOURCE -D_GNU_SOURCE
We can probably set this for all compilers on all OSes, because either a compiler understands the flag and sets the value to the supported level or the flag is ignored.
@valentynbez can you confirm this fixed the issue for you on CentOS 7?