The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Building zlib with Visual Studio

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Daniel Berger

Posts: 1383
Nickname: djberg96
Registered: Sep, 2004

Daniel Berger is a Ruby Programmer who also dabbles in C and Perl
Building zlib with Visual Studio Posted: Feb 27, 2014 9:53 AM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Daniel Berger.
Original Post: Building zlib with Visual Studio
Feed Title: Testing 1,2,3...
Feed URL: http://djberg96.livejournal.com/data/rss
Feed Description: A blog on Ruby and other stuff.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Daniel Berger
Latest Posts From Testing 1,2,3...

Advertisement
This is one of those posts I'm making for future reference because I always forget.

If you've built Ruby with Visual Studio (instead of using the mingw32 stuff), you'll need to build zlib from source. You could use the pr-zlib library, but it's slower and you'll need to install it in a non-conventional manner. Anyway, under the zlib-x.y.z/contrib/vstudio directory, look for the subdirectory that matches your version of Visual Studio, e.g. "vc10". You'll see a solution file (.sln) file there. Open that solution in Visual Studio.

You should see several projects in that solution. Remove them all except "zlibvc", as it's the only one you'll need. Before you build it, you'll need to remove the ZLIB_WINAPI preprocessor definition (under Project -> Properties -> Configuration Properties -> C/C++ -> Preprocessor, on Visual Studio 10 anyway). Once that's done, build your solution. It will generate some files in zlib-x.y.z/contrib/vstudio/vc10/x86/zlibdlldebug. Look for the .dll and .lib files, and put them someplace sane, like c:/usr/lib. I also copy all the .h files to c:/usr/include. You may also need to copy the .dll file to the c:/ruby/bin directory.

Once those files are in place, cd back to your Ruby source directory under ruby-x.y.x/ext/zlib, and run "ruby extconf.rb --with-zlib-dir=c:/usr; nmake; nmake install", modifying the dir to wherever you put the files. One caveat here is that the zlib folks seem to like to tinker with the zlib output file names. You can either edit the extconf.rb file to make sure it picks them up, or just rename the .dll and .lib files to "zlib.dll" and "zlib.lib", respectively before trying to build it.

Once that's done fire up irb and do "require 'zlib'" to make sure it works.

Read: Building zlib with Visual Studio

Topic: The End of RubyForge Previous Topic   Next Topic Topic: 8 Things Github’s Atom Editor is not going to solve for you

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use