New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not use _GNU_SOURCE gratuitously. #1129
Conversation
Never ending story. We didn't have FreeBSD coverage before in
|
Maybe with minimal FTMs we're adding FreeBSD limits availability of non-POSIX interfaces. Or something like that. I may need to set up FreeBSD VM to play with it more, maybe during weekend. Haven't touched FreeBSD in many years. |
By looking at headers only: So I looked at other popular BSD headers too. For OpenBSD And for NetBSD I'll have to add all this to Makefile and CMakeLists.txt with appropriate comments, so that it could be most likely removed if/when EDIT: |
Before updating this PR, I will create yet another PR to simply add support for building on DragonFlyBSD/NetBSD/OpenBSD, then I will rebase this one on top of that with new BSD-related refinements. |
@ggerganov, when you'll have some spare time for |
6ad3ee5
to
d42b826
Compare
Will look to merge this after the sync: #1247 |
d42b826
to
288bf71
Compare
I saw that #1247 got merged. |
Portable applications should employ |
#1251 has been created. |
What is needed to build whisper.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 in ggml, so enable GNU libc extensions for Linux builds to cover that. There is no need to penalize musl libc which simply follows standards. 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 minimal FTM (_XOPEN_SOURCE=600) or other FTM depending on their needs. It builds without issues in Alpine (musl libc), Ubuntu (glibc), MSYS2.
Avoid macOS build error when _DARWIN_C_SOURCE is not defined, brought by SDL2 relying on Darwin extension memset_pattern4/8/16 (from string.h).
288bf71
to
f6af9e0
Compare
Rebased after #1251 got merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the effort @przemoc !
You're welcome! |
* ci : upgrade gradle to 2.4.2 * cmake : add comment (#1129)
* master: (96 commits) whisper : fix bench regression + fix performance when using CPU BLAS (ggerganov#1275) whisper : faster beam_search sampling via reduced KV cache copies (ggerganov#1243) java : fixed signing of java artifact using gradle (ggerganov#1267) ci : try to fix gradle action (ggerganov#1265) gitignore : update sync : ggml (HBM + Metal + style) (ggerganov#1264) ci : upgrade gradle to 2.4.2 (ggerganov#1263) sync : ggml (CUDA faster rope) cmake : noramlize case (ggerganov#1129) build : do not use _GNU_SOURCE gratuitously (ggerganov#1129) examples : fix build + compile warnings (close ggerganov#1256) models : add quantum models to download-ggml-model.sh (ggerganov#1235) whisper.android : bump gradle plugin and dependencies + a lint pass (ggerganov#1255) sign jar for Maven Central repo whisper.android : address ARM's big.LITTLE arch by checking cpu info (ggerganov#1254) make : fix detection of AVX2 on macOS (ggerganov#1250) ggml : posixify pagesize (ggerganov#1251) configured publishing.repositories ggml : sync latest llama.cpp (view_src + alloc improvements) (ggerganov#1247) make : improve cpuinfo handling on x86 hosts (ggerganov#1238) ...
* ci : upgrade gradle to 2.4.2 * cmake : add comment (ggerganov#1129)
* Do not use _GNU_SOURCE gratuitously. What is needed to build whisper.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 in ggml, so enable GNU libc extensions for Linux builds to cover that. There is no need to penalize musl libc which simply follows standards. 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 minimal FTM (_XOPEN_SOURCE=600) or other FTM depending on their needs. It builds without issues in Alpine (musl libc), Ubuntu (glibc), MSYS2. * examples : include SDL headers before other headers Avoid macOS build error when _DARWIN_C_SOURCE is not defined, brought by SDL2 relying on Darwin extension memset_pattern4/8/16 (from string.h). * 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
* ci : upgrade gradle to 2.4.2 * cmake : add comment (ggerganov#1129)
* Do not use _GNU_SOURCE gratuitously. What is needed to build whisper.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 in ggml, so enable GNU libc extensions for Linux builds to cover that. There is no need to penalize musl libc which simply follows standards. 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 minimal FTM (_XOPEN_SOURCE=600) or other FTM depending on their needs. It builds without issues in Alpine (musl libc), Ubuntu (glibc), MSYS2. * examples : include SDL headers before other headers Avoid macOS build error when _DARWIN_C_SOURCE is not defined, brought by SDL2 relying on Darwin extension memset_pattern4/8/16 (from string.h). * 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
* ci : upgrade gradle to 2.4.2 * cmake : add comment (ggerganov#1129)
* Do not use _GNU_SOURCE gratuitously. What is needed to build whisper.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 in ggml, so enable GNU libc extensions for Linux builds to cover that. There is no need to penalize musl libc which simply follows standards. 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 minimal FTM (_XOPEN_SOURCE=600) or other FTM depending on their needs. It builds without issues in Alpine (musl libc), Ubuntu (glibc), MSYS2. * examples : include SDL headers before other headers Avoid macOS build error when _DARWIN_C_SOURCE is not defined, brought by SDL2 relying on Darwin extension memset_pattern4/8/16 (from string.h). * 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
* ci : upgrade gradle to 2.4.2 * cmake : add comment (ggerganov#1129)
* Do not use _GNU_SOURCE gratuitously. What is needed to build whisper.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 in ggml, so enable GNU libc extensions for Linux builds to cover that. There is no need to penalize musl libc which simply follows standards. 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 minimal FTM (_XOPEN_SOURCE=600) or other FTM depending on their needs. It builds without issues in Alpine (musl libc), Ubuntu (glibc), MSYS2. * examples : include SDL headers before other headers Avoid macOS build error when _DARWIN_C_SOURCE is not defined, brought by SDL2 relying on Darwin extension memset_pattern4/8/16 (from string.h). * 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
* ci : upgrade gradle to 2.4.2 * cmake : add comment (ggerganov#1129)
Follow up to previous attempt #1027 that had to be reverted due to not being complete, which was exposed after syncing new stuff from
llama.cpp
. It uses improvements from ggerganov/llama.cpp#2035 (courtesy of @howard0su).