[poppler] Can't open files bigger than 2 GB on linux with cmake-generated config.h

Fabio D'Urso fabiodurso at hotmail.it
Thu Apr 25 16:24:41 PDT 2013


I compile poppler via CMake and, if I try to open a large file (>2 GB) on my 
32-bit linux system, I get the following error:
 Error: Couldn't open file 'big.pdf': Value too large for defined data type.

Turns out that open() refuses to open large files unless
 #define _FILE_OFFSET_BITS 64
is defined.

So I've checked how config.h is generated and I noticed that only autotool's 
config.h.in defines _FILE_OFFSET_BITS.
CMake's config.h.cmake has this and a few similar macros commented out:

 /* Number of bits in a file offset, on hosts where this is settable. */
 /* #undef _FILE_OFFSET_BITS */

 /* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
 /* #undef _LARGEFILE_SOURCE */

 /* Define for large files, on AIX-style hosts. */
 /* #undef _LARGE_FILES */

On my system, manually setting #define _FILE_OFFSET_BITS 64
in the generated config.h file is enough to make LFS work.

Unfortunately, cmake stuff is out of my comfort zone, so I can't write a 
proper patch myself :(


More information about the poppler mailing list