Expressly disable large file APIs on Android 4.4 and earlier
authorPo Lu <luangruo@yahoo.com>
Mon, 6 May 2024 12:55:49 +0000 (20:55 +0800)
committerPo Lu <luangruo@yahoo.com>
Mon, 6 May 2024 13:00:01 +0000 (21:00 +0800)
* configure.ac (CFLAGS): Add -D_FILE_OFFSET_BITS=32 on SDK 20
and earlier that unserviceable functions may not be selected.
Problem reported by Ruth Elburn <ruth@noreply.invalid>.

configure.ac

index d3effc0f4f38b5c046824119a89c5b7219489ddb..69a8ba0a9f8f758de2c5bc30193f654c85ced22f 100644 (file)
@@ -40,7 +40,13 @@ if test "$XCONFIGURE" = "android"; then
   CFLAGS="$ANDROID_CFLAGS -Werror=implicit-function-declaration"
   # Don't explicitly enable support for large files unless Emacs is
   # being built for API 21 or later.  Otherwise, mmap does not work.
+  #
+  # Moreover, 64-bit variants of file IO functions in the C library are
+  # liable to fail with ENOSYS or EINVAL on earlier API versions, and as
+  # such their definitions must be explicitly disabled on NDK releases
+  # that enable them by default.
   AS_IF([test "$ANDROID_SDK" -lt "21"], [
+    CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=32"
     enable_largefile=no
     enable_year2038=no])
 fi