Skip to content

Commit 869d87f

Browse files
committed
CMakeLists.txt: use 64-bit file API on 32-bit linux
Without the change `doxygen` fails to run when built against `i686-linux` target and installed on thew filesystem with 64-bit inodes (`btrfs` with many files in my case): $ doxygen -g && doxygen && echo ok Configuration file 'Doxyfile' created. ... error: Doxyfile not found and no input file specified! This happens because the inode number is outside 32-bit values: $ stat Doxyfile ... Device: 0,31 Inode: 11833552292 Links: 1 After the change the doc generation succeeds as expected: $ doxygen -g && doxygen && echo ok ... ok The change enables the respective macros to enable 64-bit API.
1 parent 6d6235d commit 869d87f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@ endif()
124124

125125
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSQLITE_OMIT_LOAD_EXTENSION=1")
126126

127+
# Use 64-bit off_t on 32-bit Linux
128+
if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
129+
# ensure 64bit offsets are used for filesystem accesses for 32bit compilation
130+
add_compile_definitions(_FILE_OFFSET_BITS=64)
131+
endif()
132+
127133
if (WIN32)
128134
if (MSVC)
129135
if (NOT ICONV_DIR)

0 commit comments

Comments
 (0)