]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commit
build : do not use _GNU_SOURCE gratuitously (#2035)
authorPrzemysław Pawełczyk <redacted>
Fri, 8 Sep 2023 12:09:21 +0000 (14:09 +0200)
committerGitHub <redacted>
Fri, 8 Sep 2023 12:09:21 +0000 (15:09 +0300)
commitcb6c44c5e045709b6bb5cc9bb8c9be107c771a78
tree24ddc804a76d36fba1d5e5f9b2ad4e073be9f58a
parenta21baeb12202a9020b48c53beaaf4b355228e8ba
build : do not use _GNU_SOURCE gratuitously (#2035)

* Do not use _GNU_SOURCE gratuitously.

What is needed to build llama.cpp and examples is availability of
stuff defined in The Open Group Base Specifications Issue 6
(https://pubs.opengroup.org/onlinepubs/009695399/) known also as
Single Unix Specification v3 (SUSv3) or POSIX.1-2001 + XSI extensions,
plus some stuff from BSD that is not specified in POSIX.1.

Well, that was true until NUMA support was added recently,
so enable GNU libc extensions for Linux builds to cover that.

Not having feature test macros in source code gives greater flexibility
to those wanting to reuse it in 3rd party app, as they can build it with
FTMs set by Makefile here or other FTMs depending on their needs.

It builds without issues in Alpine (musl libc), Ubuntu (glibc), MSYS2.

* make : enable Darwin extensions for macOS to expose RLIMIT_MEMLOCK

* make : enable BSD extensions for DragonFlyBSD to expose RLIMIT_MEMLOCK

* make : use BSD-specific FTMs to enable alloca on BSDs

* make : fix OpenBSD build by exposing newer POSIX definitions

* cmake : follow recent FTM improvements from Makefile
CMakeLists.txt
Makefile
examples/beam-search/beam-search.cpp
examples/embd-input/embd-input-lib.cpp
examples/main/main.cpp
examples/simple/simple.cpp
examples/speculative/speculative.cpp
ggml-alloc.c
ggml.c
llama.cpp