From: Marc Chevrier Date: Wed, 23 Sep 2020 16:06:35 +0000 (+0200) Subject: [PATCH] Linux: Compile with _FILE_OFFSET_BITS=64 on 32-bit Linux X-Git-Tag: archive/raspbian/3.18.4-1+rpi1^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=00667df055a166e0ed7a0634f1304d21cd145f7a;p=cmake.git [PATCH] Linux: Compile with _FILE_OFFSET_BITS=64 on 32-bit Linux 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 --- diff --git a/CompileFlags.cmake b/CompileFlags.cmake index 053259f4..1c5f1bec 100644 --- a/CompileFlags.cmake +++ b/CompileFlags.cmake @@ -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