RFC: including zlib.dll on Win32

John Arbash Meinel john at arbash-meinel.com
Tue Apr 21 23:07:10 BST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm working on building the 1.14rc2 installers for Windows, and I'm
running into the problem of not being able to find "zlib.dll" and the
"zlib.h" headers.

The main problem is that I've done something on my own machine, which
means that everything "Just Works" without any extra configuration.
However, when I try to compile on Kerguelen, it cannot find the zlib.h
header.

I can manually add "include_dirs=[]" to the build, and then it starts
working. I can then create an environment variable that 'setup.py' looks
at, and have it use that to add extra include directories into the build
toolchain.

However, I'd like to make sure whatever solution is reasonably generic.

I would also *really* like to understand why things are found on my machine.

The compile commands on my machine seems to be:
C:\cygwin\bin\gcc.exe -mno-cygwin -mdll -O -Wall -DWIN32
- -Ic:\Python25\include -Ic:\Python25\PC -c bzrlib/_chk_map_pyx.c -o
build\temp.win32-2.5\Release\bzrlib\_chk_map_pyx.o
writing build\temp.win32-2.5\Release\bzrlib\_chk_map_pyx.def

C:\cygwin\bin\gcc.exe -mno-cygwin -shared -s
build\temp.win32-2.5\Release\bzrlib\_chk_map_pyx.o
build\temp.win32-2.5\Release\bzrlib\_chk_map_pyx.def -Lc:\Python25\libs
- -Lc:\Python25\PCBuild -lz -lpython25 -lmsvcr71 -o bzrlib\_chk_map_pyx.pyd

And as near as I can tell, there is no 'zlib.h' in any of those
directories. I *do* have zlib.h installed into C:/local/include and
zlib.lib in C:/local/lib, as a part of some of my other development
work. I also installed GTK a while back, which ends up creating C:\GTK
and then installing zlib in C:\GTK\INCLUDE, etc. Which also sets an env
var "INCLUDE=C:\GTK\INCLUDE".

However, if I just:

  export INCLUDE='C:\home\shared\3rdparty\zlib123\include'

doing 'py setup.py build_ext' doesn't seem to find the library.


Anyway, I'd like to make a nice simple patch to 'setup.py' so that
building will work. And on Windows you'll have to download the zlib.zip
file, and configure something like an env variable.

What do people think? Should I create new env vars like
"BZR_EXTRA_INCLUDE='X;Y;Z'" and then pass that into
Extension(include_dirs=[BZR_EXTRA_INCLUDE.split(os.pathsep)]) ?

I'd need to have 2 variables, for BZR_EXTRA_INCLUDE and BZR_EXTRA_LIB.
(or EXTRA_LIB_DIRS, etc.)

Any ideas on a tasteful way to enable linking against a 3rd party on
Windows using distutils? I'll also mention that this needs to support
both MSVC and Mingw as compilers.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAknuQyUACgkQJdeBCYSNAAO9QACgtXzK7KTxjvGoyPsYy7NeHO0s
SG4AoMMpFO1HYbEs71+dmDkn804MoGGY
=JMyy
-----END PGP SIGNATURE-----



More information about the bazaar mailing list