Commit d77256999 for llama.cpp
commit d77256999f211f8c0a5b12d13564f48d685b59e7
Author: Bill Sideris <bill88t@feline.gr>
Date: Thu Oct 22 15:40:13 2026 +0300
vulkan: replace std::aligned_alloc with posix_memalign for termux compatibility (#30828)
std::aligned_alloc is unavailable on Android bionic below API 28 (Termux targets API 24); use posix_memalign like ggml.c does.
diff --git a/ggml/src/ggml-vulkan/ggml-vulkan-buffers.cpp b/ggml/src/ggml-vulkan/ggml-vulkan-buffers.cpp
index b687b1390..7e9b3fa75 100644
--- a/ggml/src/ggml-vulkan/ggml-vulkan-buffers.cpp
+++ b/ggml/src/ggml-vulkan/ggml-vulkan-buffers.cpp
@@ -9,7 +9,11 @@ static void * portable_aligned_malloc(size_t align, size_t size) {
#ifdef _WIN32
return _aligned_malloc(size, align);
#else
- return std::aligned_alloc(align, size);
+ void * ptr = nullptr;
+ if (posix_memalign(&ptr, align, size) != 0) {
+ return nullptr;
+ }
+ return ptr;
#endif
}