]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
Revert "ggml : do not use _GNU_SOURCE gratuitously (#1027)"
authorGeorgi Gerganov <redacted>
Sun, 2 Jul 2023 18:53:52 +0000 (21:53 +0300)
committerGeorgi Gerganov <redacted>
Sun, 2 Jul 2023 18:53:52 +0000 (21:53 +0300)
This reverts commit 3f7a03ebe3b65be0792849e300a122f6a050e3f8.

Makefile
examples/command/command.cpp
examples/stream/stream.cpp
examples/talk-llama/llama.cpp
examples/talk-llama/talk-llama.cpp
examples/talk/talk.cpp
ggml.c

index a9ae2e7ab96d368712b39b8ed9d75b640b904aea..045f711c6966813b4e9e8b676579e8b4fb644191 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -36,12 +36,11 @@ CFLAGS   = -I.              -O3 -DNDEBUG -std=c11   -fPIC
 CXXFLAGS = -I. -I./examples -O3 -DNDEBUG -std=c++11 -fPIC
 LDFLAGS  =
 
-# clock_gettime came in POSIX.1b (1993)
-# CLOCK_MONOTONIC came in POSIX.1-2001 / SUSv3 as optional
-# posix_memalign came in POSIX.1-2001 / SUSv3
-# M_PI is an XSI extension since POSIX.1-2001 / SUSv3, came in XPG1 (1985)
-CFLAGS   += -D_XOPEN_SOURCE=600
-CXXFLAGS += -D_XOPEN_SOURCE=600
+# ref: https://github.com/ggerganov/whisper.cpp/issues/37
+ifneq ($(wildcard /usr/include/musl/*),)
+       CFLAGS += -D_POSIX_SOURCE -D_GNU_SOURCE
+       CXXFLAGS += -D_POSIX_SOURCE -D_GNU_SOURCE
+endif
 
 # RLIMIT_MEMLOCK came in BSD, is not specified in POSIX.1,
 # and on macOS its availability depends on enabling Darwin extensions
index d39af7309a29cc4e25a0290a9f7913a42b1e7b77..54e3549f3bc6884ddca22c97dc0b8efddaec54de 100644 (file)
@@ -6,8 +6,8 @@
 // ref: https://github.com/ggerganov/whisper.cpp/issues/171
 //
 
-#include "common-sdl.h"
 #include "common.h"
+#include "common-sdl.h"
 #include "whisper.h"
 
 #include <sstream>
index e44c1f60e25b34f88c49e0ebe87fc8b4966fd9b0..cec5a2b7ce5974a5d0c18b0bf2d935d23ef736e3 100644 (file)
@@ -3,8 +3,8 @@
 // A very quick-n-dirty implementation serving mainly as a proof of concept.
 //
 
-#include "common-sdl.h"
 #include "common.h"
+#include "common-sdl.h"
 #include "whisper.h"
 
 #include <cassert>
index 04d78e03bb8b4119565d06e65b876359c19afcb8..942407b84a3f3234c1f6f175c2c2758fe5a118f6 100644 (file)
@@ -1,3 +1,11 @@
+// Defines fileno on msys:
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#include <cstddef>
+#include <cstdint>
+#include <cstdio>
+#endif
+
 #include "llama-util.h"
 #include "llama.h"
 
index 18658669a8a4244a255b34e4bc89e9d335979a0d..57a02eacf627068d0092641a4c51e8e652c63504 100644 (file)
@@ -1,8 +1,8 @@
 // Talk with AI
 //
 
-#include "common-sdl.h"
 #include "common.h"
+#include "common-sdl.h"
 #include "whisper.h"
 #include "llama.h"
 
index 12d98a0033b2a7b64ed8fdee01edd616b03c8100..651ca2008f3e426d063bd1f625c7d5b2e0415605 100644 (file)
@@ -1,8 +1,8 @@
 // Talk with AI
 //
 
-#include "common-sdl.h"
 #include "common.h"
+#include "common-sdl.h"
 #include "whisper.h"
 #include "gpt-2.h"
 
diff --git a/ggml.c b/ggml.c
index b7cfcf4ec82c93a6200948cda3447e7358b0ada3..88cbed7d5347c6e8cb07003769385860d4d450c9 100644 (file)
--- a/ggml.c
+++ b/ggml.c
@@ -1,3 +1,4 @@
+#define _GNU_SOURCE // Defines CLOCK_MONOTONIC on Linux
 #define _CRT_SECURE_NO_DEPRECATE // Disables ridiculous "unsafe" warnigns on Windows
 
 #include "ggml.h"