[PATCH] Linux: Compile with _FILE_OFFSET_BITS=64 on 32-bit Linux
authorMarc Chevrier <marc.chevrier@gmail.com>
Wed, 23 Sep 2020 16:06:35 +0000 (18:06 +0200)
committerFelix Geyer <fgeyer@debian.org>
Mon, 19 Oct 2020 14:20:14 +0000 (15:20 +0100)
To avoid problems accessing filesystem, use 64-bit file offsets when
compilation model is 32-bit.  This explicit definition is needed now
that KWSys does not provide LFS settings in its headers anymore.

Fixes: #20568
Gbp-Pq: Name Compile_with_FILE_OFFSET_BITS_64_on_32-bit_Linux.patch

CompileFlags.cmake

index 053259f47c8df022a73ed7e253ce371b9428cc72..1c5f1beca959109fbd911fd407ff9b389b4a7de2 100644 (file)
@@ -53,6 +53,12 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^parisc")
   endif()
 endif()
 
+# Use 64-bit off_t on 32-bit Linux
+if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
+  # ensure 64bit offsets are used for filesystem accesses for 32bit compilation
+  add_definitions(-D_FILE_OFFSET_BITS=64)
+endif()
+
 # Workaround for TOC Overflow on ppc64
 set(bigTocFlag "")
 if(CMAKE_SYSTEM_NAME STREQUAL "AIX" AND