Skip to content

Commit 3873e4b

Browse files
committed
Revert "ggml : do not use _GNU_SOURCE gratuitously (ggml-org#1027)"
This reverts commit 3f7a03e.
1 parent 422b2e8 commit 3873e4b

File tree

7 files changed

+18
-10
lines changed

7 files changed

+18
-10
lines changed

Makefile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,11 @@ CFLAGS = -I. -O3 -DNDEBUG -std=c11 -fPIC
3636
CXXFLAGS = -I. -I./examples -O3 -DNDEBUG -std=c++11 -fPIC
3737
LDFLAGS =
3838

39-
# clock_gettime came in POSIX.1b (1993)
40-
# CLOCK_MONOTONIC came in POSIX.1-2001 / SUSv3 as optional
41-
# posix_memalign came in POSIX.1-2001 / SUSv3
42-
# M_PI is an XSI extension since POSIX.1-2001 / SUSv3, came in XPG1 (1985)
43-
CFLAGS += -D_XOPEN_SOURCE=600
44-
CXXFLAGS += -D_XOPEN_SOURCE=600
39+
# ref: https://github.com/ggerganov/whisper.cpp/issues/37
40+
ifneq ($(wildcard /usr/include/musl/*),)
41+
CFLAGS += -D_POSIX_SOURCE -D_GNU_SOURCE
42+
CXXFLAGS += -D_POSIX_SOURCE -D_GNU_SOURCE
43+
endif
4544

4645
# RLIMIT_MEMLOCK came in BSD, is not specified in POSIX.1,
4746
# and on macOS its availability depends on enabling Darwin extensions

examples/command/command.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
// ref: https://github.com/ggerganov/whisper.cpp/issues/171
77
//
88

9-
#include "common-sdl.h"
109
#include "common.h"
10+
#include "common-sdl.h"
1111
#include "whisper.h"
1212

1313
#include <sstream>

examples/stream/stream.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// A very quick-n-dirty implementation serving mainly as a proof of concept.
44
//
55

6-
#include "common-sdl.h"
76
#include "common.h"
7+
#include "common-sdl.h"
88
#include "whisper.h"
99

1010
#include <cassert>

examples/talk-llama/llama.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
// Defines fileno on msys:
2+
#ifndef _GNU_SOURCE
3+
#define _GNU_SOURCE
4+
#include <cstddef>
5+
#include <cstdint>
6+
#include <cstdio>
7+
#endif
8+
19
#include "llama-util.h"
210
#include "llama.h"
311

examples/talk-llama/talk-llama.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Talk with AI
22
//
33

4-
#include "common-sdl.h"
54
#include "common.h"
5+
#include "common-sdl.h"
66
#include "whisper.h"
77
#include "llama.h"
88

examples/talk/talk.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Talk with AI
22
//
33

4-
#include "common-sdl.h"
54
#include "common.h"
5+
#include "common-sdl.h"
66
#include "whisper.h"
77
#include "gpt-2.h"
88

ggml.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#define _GNU_SOURCE // Defines CLOCK_MONOTONIC on Linux
12
#define _CRT_SECURE_NO_DEPRECATE // Disables ridiculous "unsafe" warnigns on Windows
23

34
#include "ggml.h"

0 commit comments

Comments
 (0)