[Zlib-devel] zlib 1.2.3.2 available for testing

Lasse Collin lasse.collin at tukaani.org
Tue Sep 5 16:21:10 EDT 2006


Mark Adler wrote:
> On Sep 5, 2006, at 10:35 AM, Lasse Collin wrote:
> > Defining z_off_t to be off64_t makes some applications to no longer
> > compile, because off64_t isn't available on glibc unless
> > _LARGEFILE64_SOURCE is defined.
>
> In the 1.2.3.2, off64_t is used only when _LARGEFILE64_SOURCE is
> defined, and both are done only if the off64_t type is in sys/types.h
> when _LARGEFILE64_SOURCE is defined.

I was talking about applications compiled against zlib. With zlib 
1.2.3.2, this code doesn't compile without _LARGEFILE64_SOURCE:

#include <zlib.h>
int main() { return 0; }

$ gcc -D_FILE_OFFSET_BITS=64  foo.c
In file included from foo.c:1:
zlib.h:1195: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ 
before ‘gzseek’
zlib.h:1220: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ 
before ‘gztell’
zlib.h:1292: error: expected declaration specifiers or ‘...’ 
before ‘off64_t’
zlib.h:1317: error: expected declaration specifiers or ‘...’ 
before ‘off64_t’

It doesn't help if I omit -D_FILE_OFFSET_BITS=64. I'm using GCC 4.1.1 
and glibc 2.3.6.

> > I would prefer compiling zlib with _FILE_OFFSET_BITS=64 by default
> > (have
> > a configure option to disable it), and using off_t instead of
> > off64_t.
>
> I used off64_t since I could test for it in configure and know for
> sure that the compiler option made sense and that the type is 64
> bits.  I'm not sure I like a solution where there is always a (long)
> -D compiler option that may or may not be relevant.

Autoconf tries first without any defines, then _FILE_OFFSET_BITS=64 and 
finally _LARGE_FILES=1. Here's the code that is tried to be compiled:

#include <sys/types.h>
 /* Check that off_t can represent 2**63 - 1 correctly.
    We can't simply define LARGE_OFF_T to be 9223372036854775807,
    since some C++ compilers masquerading as C compilers
    incorrectly reject 9223372036854775807.  */
#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
                       && LARGE_OFF_T % 2147483647 == 1)
                      ? 1 : -1];
int
main ()
{

  ;
  return 0;
}

-- 
Lasse Collin  |  IRC: Larhzu @ IRCnet & Freenode




More information about the Zlib-devel mailing list