From 0cd04dba27933c85d7ba1e7e093bd8d1eab44ef0 Mon Sep 17 00:00:00 2001 From: Olli Wang Date: Thu, 18 Sep 2025 20:37:18 +0800 Subject: [PATCH] Fixes build failure on modern NDKs (r23+). Define `USE_FILE32API` to force a fallback from the missing `ftello()`/`fseeko()` to the standard `ftell()`/`fseek()`, resolving the compile error. This may limit support for files > 2GB on 32-bit systems. --- CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 05ccb297..7ba72ae9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,6 +65,15 @@ set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake") set(targets_export_name "${PROJECT_NAME}Targets") set(namespace "${PROJECT_NAME}::") +# Workaround for minizip build failure on modern NDKs (r23+). +# Define USE_FILE32API to force a fallback from the missing ftello()/fseeko() +# to the standard ftell()/fseek(), resolving the compile error. This may +# limit support for files > 2GB on 32-bit systems. +if(ANDROID AND CMAKE_C_COMPILER_ID MATCHES "Clang") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_FILE32API" CACHE STRING "C compiler flags" FORCE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_FILE32API" CACHE STRING "C++ compiler flags" FORCE) +endif() + option(USE_AES "enables building of aes library" ON) if(USE_AES) set(AES_SRC