alpaca.cpp
alpaca.cpp copied to clipboard
not building in linux: ggml.c:315:19: error: ‘CLOCK_MONOTONIC’ undeclared
/home# mkdir alpaca
/home#
/home# cd alpaca/
/home/alpaca# git clone https://github.com/antimatter15/alpaca.cpp
Cloning into 'alpaca.cpp'...
remote: Enumerating objects: 509, done.
remote: Total 509 (delta 0), reused 0 (delta 0), pack-reused 509
Receiving objects: 100% (509/509), 1.31 MiB | 23.18 MiB/s, done.
Resolving deltas: 100% (280/280), done.
/home/alpaca# cd alpaca.cpp
/home/alpaca/alpaca.cpp#
/home/alpaca/alpaca.cpp# make
I llama.cpp build info:
I UNAME_S: Linux
I UNAME_P: x86_64
I UNAME_M: x86_64
I CFLAGS: -I. -O3 -DNDEBUG -std=c11 -fPIC -pthread -mavx -mavx2 -mfma -mf16c -msse3
I CXXFLAGS: -I. -I./examples -O3 -DNDEBUG -std=c++11 -fPIC -pthread
I LDFLAGS:
I CC: cc (Ubuntu 5.5.0-12ubuntu1~16.04) 5.5.0 20171010
I CXX: g++ (Ubuntu 5.5.0-12ubuntu1~16.04) 5.5.0 20171010
cc -I. -O3 -DNDEBUG -std=c11 -fPIC -pthread -mavx -mavx2 -mfma -mf16c -msse3 -c ggml.c -o ggml.o
ggml.c: In function ‘ggml_time_ms’:
ggml.c:309:5: warning: implicit declaration of function ‘clock_gettime’ [-Wimplicit-function-declaration]
clock_gettime(CLOCK_MONOTONIC, &ts);
^
ggml.c:309:19: error: ‘CLOCK_MONOTONIC’ undeclared (first use in this function)
clock_gettime(CLOCK_MONOTONIC, &ts);
^
ggml.c:309:19: note: each undeclared identifier is reported only once for each function it appears in
ggml.c: In function ‘ggml_time_us’:
ggml.c:315:19: error: ‘CLOCK_MONOTONIC’ undeclared (first use in this function)
clock_gettime(CLOCK_MONOTONIC, &ts);
^
Makefile:186: recipe for target 'ggml.o' failed
make: *** [ggml.o] Error 1
try adding -D_POSIX_C_SOURCE=199309L to the line 33, which helps time.h header define it.
Try running cmake . in the alpaca.cpp directory to resolve the issue and generate necessary build files.