aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOnur Gündüz <ogunduz@gmail.com>2026-06-21 11:45:25 +0200
committerOnur Gündüz <ogunduz@gmail.com>2026-06-21 11:45:25 +0200
commit843a1bb16f05a509392a811e725ea97c85e7a143 (patch)
tree2a5dce70235f39a079158a03ac58d77334842105
parent0fa8d815a2b80402b4509cd6f9acb807deb923a4 (diff)
downloadffwd-843a1bb16f05a509392a811e725ea97c85e7a143.tar.gz
ffwd-843a1bb16f05a509392a811e725ea97c85e7a143.zip
build: define _DEFAULT_SOURCE so glibc declares strdup under -std=c11
-rw-r--r--build.mk5
1 files changed, 5 insertions, 0 deletions
diff --git a/build.mk b/build.mk
index 62e7f45..0a67721 100644
--- a/build.mk
+++ b/build.mk
@@ -57,7 +57,12 @@ MLXC_PREFIX := $(shell brew --prefix mlx-c 2>/dev/null)
# -fapprox-func are the unsafe parts and stay off).
# -fvisibility=hidden pairs with FFWD_API in the public headers: a new
# public function without the annotation will be missing from the shared lib.
+# _DEFAULT_SOURCE exposes POSIX/BSD declarations (strdup, strndup, ...) under
+# -std=c11: strict C11 defines __STRICT_ANSI__, so glibc otherwise hides them,
+# and an implicit int return truncates the 64-bit pointer (crashes on Linux;
+# macOS declares them regardless, which hid this).
CFLAGS_BASE = -Wall -Wextra -O3 $(ARCH_FLAGS) -fPIC -fvisibility=hidden \
+ -D_DEFAULT_SOURCE \
-fno-math-errno -ffp-contract=fast -fno-trapping-math \
-fno-signed-zeros -fassociative-math -freciprocal-math