Building zlib 1.2.5 on windows

To build zlib on windows I did the following:

  1. Opened up a windows cmd prompt and ran vsvars32.bat from C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools (You may need to change this depending on which version of Visual Studio you may have)
  2. Ran nmake -f win32/Makefile.msc. At this point I ran into a LNK2001 error with _inflate_fast being unresolved
  3. Editted Makefile.msc to add the inffast.obj to the OBJS target per the hint given at here Chinese instructions to build zlib on Windows
  4. Reran nmake -f win32/Makefile.msc. This time it worked.

Edit: Justin in the comments pointed out a better way to resolve this issue:

There is a facility in the Makefile that lets you chose if you want the regular inffast, or one that was written in assembler (there is a 32-bit of 64-bit version).
Instead of editing the Makefile, you can instead use
nmame -f win32/Makefile.msc OBJA=inffast.obj
or instead of using inffast.obj, you can pick on of the assembler built ones

  1. That worked perfectly – thanks for that. It’s been a while since I’ve worked with makefiles!!

  2. There is a facility in the Makefile that lets you chose if you want the regular inffast, or one that was written in assembler (there is a 32-bit of 64-bit version).

    Instead of editing the Makefile, you can instead use
    nmame -f win32/Makefile.msc OBJA=inffast.obj

    or instead of using inffast.obj, you can pick on of the assembler built ones

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>