Nerdify-IT: Compiling Zlib, Part I

Posted: September 7, 2011 in Technology

In pursuing a business degree, I felt maybe I became rusty in technology, so I decided to get back into my nerd glory days of past yonder years by embarking on a quest to compile source code on Windows 7.

I downloaded a free copy of Visual Studio C++ Express 2010, and setup the command line build environment: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat.

Then I navigated to the source code of zlib 1.2.5 (http://zlib.net/), a popular compression library.  I crossed my fingers (metaphorically speaking) and typed nmake -f win32/Makefile.msc.  It seemed that everything was working, but then some errors popped up:

        link -nologo -debug -incremental:no -opt:ref -def:win32/zlib.def -dll -implib:zdll.lib  -out:zlib1.dll -base:0x5A4C0000 dler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj  gzwrite.obj infback.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj  zlib1.res
   Creating library zdll.lib and object zdll.exp
infback.obj : error LNK2019: unresolved external symbol _inflate_fast referenced in function _inflateBack
inflate.obj : error LNK2001: unresolved external symbol _inflate_fast
zlib1.dll : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: ‘”c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\link.EXE”‘ : return code ‘0x460’
Stop.

I did some explicit searches on The Internet (ironically using Bing on Google’s Chrome browser), and I found a Chinese website (http://blog.csdn.net/tylere/article/details/5798903) amongst many that had some notes about compiling the library.  The author recommends editing the makefile to fix the problem, but instead I tried the line: nmake -f win32/Makefile.msc LOC=”-DASMV -DASMINF” OBJA=”inffas32.obj match686.obj” and was successful.  I am guessing that these objects was omitted purposefully.

Now I have to register the library (regsvr32) and test against it.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s