[Python-Dev] WARNING: Changed build process for zlib on Windows

Mark Hammond MarkH@ActiveState.com
Wed, 31 Jan 2001 21:34:01 +1100


Hi all,
	In an attempt to solve "[ Bug #129293 ] zlib library used for binary win32
distribution can crash"
(https://sourceforge.net/bugs/?func=detailbug&group_id=5470&bug_id=129293),
Tim and I have decided that we should fix the build process of zlib.pyd on
windows.

The current process requires that the builder download _2_ zlib archives - a
binary distribution for zlib.lib, and the source archive for the headers.
We believe that slight differences between the 2 are causing the above bug.
A particular warning-light is that the current process defines ZLIB_DLL even
though we are _not_ currently using the DLL but the static lib.  Removing
this #define generates linker errors.

The new process is very simple, but may break some peoples build.  In theory
it _should_ still work for everyone, but if it fails to build, please check
your directory structure.

>From the comments I just added to zlib.c:

/* *** Notes for Windows Users ***
   * Download the source distribution as referenced above.
   * Unpack the distribution such that a "..\..\zlib-1.1.3" directory is
created
     relative to the "pcbuild" directory.
   * Build this "zlib" project.  Via from MSVC magic, the correct zlib
makefile will
     be run, and "..\..\zlib-1.1.3\zlib.lib" will be built before zlib.pyd.
   *** End of notes for Windows users ***
*/

Specifically, MSVC has a "pre-link step" setup that runs the zlib makefile
from the "..\..\zlib-1.1.3" directory.  The reason this _should_ not break
your build is that your _probably_ already have a "..\..\zlib-1.1.3"
directory installed in the right place so the header files can be located.

Once you have a successful build, you can delete the old "zlib113"
directory, which was the binary-only distribution.

Please let me know if this causes too much pain, or it is in someway broken
for you.

The relevant checkins are Rev 1.15 of PCbuild/zlib.dsp and Rev 2.37 of
Modules/zlibmodules.c.

Thanks,

Mark.