On Wednesday, May 22, 2013 12:54:44 PM Fabio D'Urso wrote: > On Tuesday, May 21, 2013 03:23:02 PM Albert Astals Cid wrote: > > El Divendres, 26 d'abril de 2013, a les 01:24:41, Fabio D'Urso va escriure: > > > Hi, > > > > Hi > > > > > 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 :( > > > > Can you try the following patch and tell me if it helps? > > Works for me, but I also had to change this: > > diff --git a/config.h.cmake b/config.h.cmake > index c3b30db..a8a0c46 100644 > --- a/config.h.cmake > +++ b/config.h.cmake > @@ -222,7 +222,7 @@ > #endif > > /* Number of bits in a file offset, on hosts where this is settable. */ > -/* #undef _FILE_OFFSET_BITS */ > +#cmakedefine _FILE_OFFSET_BITS @_FILE_OFFSET_BITS@ > > /* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ > /* #undef _LARGEFILE_SOURCE */ > > Tested on my laptop (Linux/x86 32 bit). > I'll test on MacOS/ppc64 when I get back home.
It works there too (=it successfully detects that, unlike on Linux/x86 32-bit, there's no need to define _FILE_OFFSET_BITS and therefore doesn't define it). > > Cheers, > > > > Albert > > > > > Fabio > > > > > > _______________________________________________ > > > poppler mailing list > > > [email protected] > > > http://lists.freedesktop.org/mailman/listinfo/poppler -- Fabio _______________________________________________ poppler mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/poppler
