[Zlib-devel] Z_SOLO & MinGW-gcc

Paul Marquess Paul.Marquess at ntlworld.com
Mon Feb 20 03:49:59 EST 2012


Let me start this with a quick bit of background - the Perl interface to
zlib includes a sub-set of the zlib 1.2.6 sources. It doesn't use the gz
code, so it excludes all the gz* files and uses Z_SOLO when building.

 

I've just received a bug report and patch from someone trying to build the
Perl interface with MinGW-gcc. 

 

Haven't used MinGW in years, so I installed it and was able to partially
reproduce the problem by just building zlib with Z_SOLO 

 

This is the error I got

 

$ make -f win32/Makefile.gcc

gcc  -O3 -Wall -DZ_SOLO -DNO_VIZ -c -o adler32.o adler32.c

adler32.c:12:30: error: unknown type name '__int64'

adler32.c: In function 'adler32_combine_':

adler32.c:139:5: error: unknown type name '__int64'

adler32.c: In function 'adler32_combine64':

adler32.c:176:5: error: unknown type name '__int64'

make: *** [adler32.o] Error 1

 

Patch enclosed for that (derived from the patch I was supplied). This works
for zlib synced from git plus 1.2.6 & 1.2.6.1

 

That part seems straightforward - but he is also having problem this part of
zutil.h 

 

#ifdef Z_SOLO

    typedef long ptrdiff_t;  /* guess -- will be caught if guess is wrong */

#endif

 

His change was to make the ptrdiff_t definition conditional

 

#ifdef Z_SOLO

#ifndef HAVE_PTRDIFF

    typedef long ptrdiff_t;  /* guess -- will be caught if guess is wrong */

#endif

#endif

 

Where HAVE_PTRDIFF gets defined if stdint.h has been included in zconf.h
(which is what the enclosed patch does).

 

#if !defined(_WIN32) && (defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0)

#  define z_off64_t off64_t

#else

#  if defined(_WIN32)

#    if defined(__GNUC__)

#      include "stdint.h"

#      define HAVE_PTRDIFF

#      define z_off64_t int64_t

#    else

#      define z_off64_t __int64

#    endif

#  else

#  define z_off64_t z_off_t

#endif

#endif

 

Interestingly I couldn't reproduce this problem at all with zlib synced from
git. It built fine regardless of whether the zutil.h change was applied or
not. 

 

I presume this is a GCC version issue. The problem was reported with MinGW
running gcc 4.4.3. I was running gcc 4.6.1

 

Anyone got an older MinGW install available to try it out?

 

Paul

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://madler.net/pipermail/zlib-devel_madler.net/attachments/20120220/ffac3319/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mingw.patch
Type: application/octet-stream
Size: 536 bytes
Desc: not available
URL: <http://madler.net/pipermail/zlib-devel_madler.net/attachments/20120220/ffac3319/attachment.obj>


More information about the Zlib-devel mailing list