소스 검색

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
Marc Chevrier 5 년 전
부모
커밋
5b10f96793
1개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  1. 6 0
      CompileFlags.cmake

+ 6 - 0
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