You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The initial make fails with CLOCK_MONOTONIC undeclared
I llama.cpp build info:
I UNAME_S: Linux
I UNAME_P: unknown
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 (Alpine 12.2.1_git20220924-r9) 12.2.1 20220924
I CXX: g++ (Alpine 12.2.1_git20220924-r9) 12.2.1 20220924
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]
309 | clock_gettime(CLOCK_MONOTONIC, &ts);
| ^~~~~~~~~~~~~
ggml.c:309:19: error: 'CLOCK_MONOTONIC' undeclared (first use in this function)
309 | 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)
315 | clock_gettime(CLOCK_MONOTONIC, &ts);
| ^~~~~~~~~~~~~~~
make: *** [Makefile:182: ggml.o] Error 1
(base) lizheng@lizheng-System-Product-Name:/home/ytkj/root1/liuxiao/LLM/llama.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.4.0-6ubuntu1~16.04.12) 5.4.0 20160609
I CXX: g++ (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609
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 foreach function it appearsin
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:182: recipe for target 'ggml.o' failed
make: *** [ggml.o] Error 1
Same happens when compiling on macOS 10.7:
ggml.c:310:19: error: use of undeclared identifier 'CLOCK MONOTONIC'
ggml.c:316:19: error: use of undeclared identifier 'CLOCK MONOTONIC'
Activity
[-]error: 'CLOCK_MONOTONIC' undeclared on Alpine Linux[/-][+]error: 'CLOCK_MONOTONIC' undeclared[/+]liuxiaocs7 commentedon Mar 13, 2023
same question
wshzd commentedon Mar 13, 2023
在ggml.h头文件中增加以下宏定义即可
#define _POSIX_C_SOURCE 199309L
anishthite commentedon Mar 14, 2023
This fixed it for me
gquarles commentedon Mar 14, 2023
Adding
-lrtto the CXXFLAGS and changing CFLAGS to use-std=gnu11worked for me, running Ubuntu 16tdr1991 commentedon Mar 15, 2023
我的机器是centos7, 我在 Makefile文件添加 -D_POSIX_C_SOURCE=199309L 可以解决问题。
Merge pull request ggml-org#54 from NatoBoram/feature/gitignore-chat
Errand24 commentedon Apr 5, 2023
Same happens when compiling on macOS 10.7:
ggml.c:310:19: error: use of undeclared identifier 'CLOCK MONOTONIC'
ggml.c:316:19: error: use of undeclared identifier 'CLOCK MONOTONIC'
build: "Implement POSIX compliance and improve test accuracy"
Rewrite the model inputs finding mechanism (ggml-org#54)
ggml : add OpenVINO backend (#15307)
2 remaining items
ggml : add OpenVINO backend (ggml-org#15307)
Improve Q4_0 and Q8_0 performance on AVX2/Zen4 (ggml-org#54)
xdna: ggml-org#54 use prescaled FlowKV cache key
xdna: ggml-org#54 use vectorized FlowKV exp cache key
ggml : add OpenVINO backend (#15307)
Feat/omni ws rebase (ggml-org#63)
ggml : add OpenVINO backend (ggml-org#15307)