Compiling Ruby 1.9.1 zlib issue on Windows

Hi everyone,

I just have a strange issue and it’s probably a step that I’m missing
somewhere…

I wanted to compile a windows version of 1.9.1 to include Tk so that I
would have cross-platform GUI for Ruby.

I downloaded and installed Tcl, and the latest Zlib installer. I
performed the following updates:

set INCLUDE=c:\tcl\include;c:\program files\GnuWin32\include;%INCLUDE%
set LIB=c:\ruby\lib;c:\tcl\lib;c:\program files\GnuWin32\lib;%LIB%
set LIBPATH=c:\ruby\lib;c:\tcl\bin;c:\tcl\lib;c:\program
files\GnuWin32\bin;c:\program files\GnuWin32\lib;%LIBPATH%
set PATH=c:\ruby\bin;c:\tcl\bin;c:\program files\GnuWin32\bin;%PATH%
set RUBYPATH=c:\ruby

I DC’d from my router and disabled/paused kaspersky so it wouldn’t
interfere with permissions during nmake…

I moved the latest 1.9.1-p129 source into a folder called c:\rubysource

cd rubysource (and hit enter)
type vcvars32 (and hit enter)
type win32\configure.bat --prefix=c:\ruby (and hit enter)
type nmake and hit enter
type nmake DESTDIR=c:\ruby install (and hit enter)

I run ruby -v (ruby 1.9.1p129 (2009-05-12 revision 23412)
[i386-mswin32_90]
I run gem -v (1.3.1)
I run IRB.
% require ‘tk’
% Tk::TK_PATCHLEVEL

… all checks out OK … so far so good…

I type gem update --system

C:/ruby/lib/ruby/1.9.1/rubygems/spec_fetcher.rb:1:in ‘require’: no such
file to load – zlib (LoadError)

I’m not sure what I’m doing wrong. I downloaded and installed the
latest zlib source (version 1.2.3)…

During the nmake process I even see it compiling zlib…

On Jun 3, 5:33 pm, “J. D.” [email protected] wrote:

The zlib file you downloaded needs to containg include headers and
linking (.lib) libraries.

Check that and that will tell you if zlib got compiled or not:

ruby -ve “require ‘zlib’; puts Zlib::ZLIB_VERSION”

HTH,

In case someone asks, the headers for zlib are located in C:\Program
Files\GnuWin32\include (zlib and zconf)

I fixed it Luis.

I just took the entire source for zlib and placed it into a folder
called c:\zlib and then copied installed .dll and .lib files into that
folder and changed my path to point to c:\zlib.

I recompiled and now both zlib and Tk are functioning properly.

Now I have an issue with rails and it appears to be related to iconv.so
being missing…

I went to irb and tried a require ‘iconv’ and it was not found. I
cannot run rails demo without getting the following error:

undefined method ‘camelize’ for “app”:String

I’m determined to complete my own compile of 1.9.1 on windows so I’m
willing to work through the issues.

Other than what you can see that I’ve done above, is there something I’m
missing? Where do I get the correct iconv.so file or how do I create
it. Anything else I might be missing?

Thanks in advance…

Luis L. wrote:

On Jun 3, 5:33�pm, “J. D.” [email protected] wrote:

The zlib file you downloaded needs to containg include headers and
linking (.lib) libraries.

Check that and that will tell you if zlib got compiled or not:

ruby -ve “require ‘zlib’; puts Zlib::ZLIB_VERSION”

HTH,

Says…

ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-mswin32_90] -e:1:in
‘require’: no such file to load – zlib (LoadError) from -e:1:in
‘’

The headers are located in c:\program files\GnuWin32\include
The .lib files are located in c:\program files\GnuWin32\lib

Before compiling my environment is set to:

set INCLUDE=c:\tcl\include;c:\program files\GnuWin32\include;%INCLUDE%
set LIB=c:\ruby\lib;c:\tcl\lib;c:\program files\GnuWin32\lib;%LIB%
set LIBPATH=c:\ruby\lib;c:\tcl\bin;c:\tcl\lib;c:\program
files\GnuWin32\bin;c:\program files\GnuWin32\lib;%LIBPATH%
set PATH=c:\ruby\bin;c:\tcl\bin;c:\program files\GnuWin32\bin;%PATH%
set RUBYPATH=c:\ruby

What do I need to do to make sure they are included? I’m not following
why it’s not including them. It includes tcl and I’ve added the
environment exactly the same way…

Thanks Luis…

I took a look at the repository and decided to play around this morning
and see how it all worked…

After git cloning locally and running a few tests:

rake (correctly builds 1.8.6)

If I run rake ruby19 CHECKOUT=1 (I receive the following error)

After the following…

nv zlib1.dll bin
cd -
cd C:/rubyinstaller (this is my local clone for the install)
svn co http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1
downloads/ruby_1_9
rake aborted!
Command failed with status (127): [svn co
http://svn.ruby-lang.org/repos/ruby…]

I tried to do rake ruby19 CHECKOUT=1 TRUNK=1 (and receive the same
error)

I would definitely like to try the easier methods when doing the build.

I just wanted to do a build for myself to see the process. But, I
realize that process is “very” long and tedious. I like the way you’ve
setup the recipes…

On Jun 3, 9:53 pm, “J. D.” [email protected] wrote:

Other than what you can see that I’ve done above, is there something I’m
missing? Where do I get the correct iconv.so file or how do I create
it. Anything else I might be missing?

Thanks in advance…

Well, your doing so many things at the same time that is hard to
follow you.

One, you compiled 1.9 with Visual Studio just to get TK, where you
could have used MinGW based version from GitHub and compile just TK on
top.

MinGW based version of Ruby already have zlib and iconv solved, but is
missing Tk.

You could invest some time and get the recipe to build it for you.

Take a look to recipes folder here:

Definitely you’re going over a complicated road building everything
from scratch. Also, asking for help is going to be trickier since your
version of Ruby is going to be built in a complete different version
than other Ruby users.

But, again, if “you’re determinated to complete your own compile of
ruby” then be my guest and steal what I did for iconv form the above
repository.

Also, I forgot to add…

On my current build I have the following:

Ruby 1.9.1 => Build Solved
Tk => Build Solved
zlib => Build Solved
iconv => Not Solved
… that’s as far as I’ve gotten thus far …

Check out my post above about the respository…

On Jun 4, 11:48 am, “J. D.” [email protected] wrote:

After the following…

nv zlib1.dll bin
cd -
cd C:/rubyinstaller (this is my local clone for the install)
svn cohttp://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1
downloads/ruby_1_9
rake aborted!
Command failed with status (127): [svn cohttp://svn.ruby-lang.org/repos/ruby…]

Ruby source code uses Subversion, which you need to install.

I recommend getting the binaries from here:

http://subversion.tigris.org/

You could try the Collabnet versions, which are Installers and setup
the PATH for you, or you can be hardcore and download the zip one :wink:

Anyway, check if subversion is available with “svn --version”

I tried to do rake ruby19 CHECKOUT=1 TRUNK=1 (and receive the same
error)

AFAIK “TRUNK” option is only available on Roger P. fork, not on
mine:

http://github.com/rogerdpack/rubyinstaller/tree/master

Both are synced, so is safe for you do the following:

git remote add roger
http://github.com/rogerdpack/rubyinstaller/tree/master
git remote update
git checkout -b roger-master roger/master

And from there, use the exact same command you pasted above.

I would definitely like to try the easier methods when doing the build.

What you did is good, I believe based on years being building my own
version of Ruby, this is the easiest way.

I just wanted to do a build for myself to see the process. But, I
realize that process is “very” long and tedious. I like the way you’ve
setup the recipes…

Indeed, the process is very tedious and error prone. Ruby itself
bundles a lot of libraries that depend on so many external tools and
libraries that turn the joy of using RUby (the language) into a
nightmare and frustration.

You can read more about the project at my blog:

http://blog.mmediasys.com/
(shameless self-promotion)

Cheers,

On Jun 4, 11:51 am, “J. D.” [email protected] wrote:

Also, I forgot to add…

On my current build I have the following:

Ruby 1.9.1 => Build Solved
Tk => Build Solved
zlib => Build Solved
iconv => Not Solved
. that’s as far as I’ve gotten thus far …

And there are like 15 more, including readline :smiley:

Check out my post above about the respository…

Done and replied.

Keep us posted on your progress.

Cheers,

Luis/Roger:

I know you both have been working heavily on the installers. I was
curious if either of you have thought of the following (for the future):

Rather than packaging Ruby in a default setup package, perhaps provide a
basic install gui that houses what would be necessary to install,
expand, and setup ruby from a remote location. In the install gui,
specifications could be made for what “additional features” a person
wishes to include with his or her ruby package.

If I’m not making sense I could clarify my thoughts better. I’m in no
way, shape or form trying to make extra work for either of you. :slight_smile:

I was just curious as to how you saw the one-click installer being used
for the future…

Thanks Luis,

I was missing subversion…

I’ll keep you posted as to my progress.

Thanks!

On 5 jun, 09:55, “J. D.” [email protected] wrote:

What you’re commenting is in the lines of a net based installer, like
Google Chrome, earlier versions of Firefox and some other looks like
MSYS and MinGW itself.

While the idea is tempting and sounds cool, the amount of work to
maintain those netinstalls is about the same.

Been building software strictly for Windows since 96 and dealing with
installers has been the Aquiles heel for every application under the
sun.

Right now I just want to focus on getting what I call “Runtime” (Ruby

  • RubyGems) out of the box asap.

Then we can focus on different ways to wrap that runtime package with
net installers that can opt in different components or packages.

Also, there is another problem: more options means more clicks.

Right now I’ve managed to reduce the clicks to 5… from the original
9 reported here:

http://rubyforge.org/tracker/index.php?func=detail&aid=22347&group_id=167&atid=715

I can tell you, reduce click is really hard, so I’m focusing my energy
on that!

:wink:

If I’m not making sense I could clarify my thoughts better. I’m in no
way, shape or form trying to make extra work for either of you. :slight_smile:

Thank God :smiley:

I was just curious as to how you saw the one-click installer being used
for the future…

Something of my above comments has been outlined here:

http://rubyinstaller.rubyforge.org/wiki/wiki.pl?Roadmap

Since move to MinGW will break lot of gems under the sun, I’m working
on making the transition the less painful as possible.

For that purpose, I’ve created rake-compiler project and helped other
gem authors provide proper and current binaries for some projects.

Once I can make it more “stable” (hopefuly in the next couple of
weeks), I’ll make an official and supported release of MinGW-based
Ruby for 1.8.6 at least.

Ruby 1.9.1 will have to wait since it’s been failing it’s bundled
tests on Windows.

Hope this information shed some light to the future of Ruby on Windows
(and google pick it up).

Regards,