Build Ruby from Source on Windows Alone?

I am not allowed to use a Windows install kit at work and must build
Ruby from source on Windows 7. Are there good, recent instructions on
doing this? I also need to minimize any gcc/MinGW/Cygwin influences
even at runtime so I don’t have to build those from source too. My
target is to use WATIR with an IE browser through the Selenium
IEDriverServer so I need to keep that working, but I could jettison
other stuff from the build if I need to. Any insight on doing such
things is greatly appreciated!

Thanks,
rcs

On Monday, January 20, 2014 2:57:32 PM UTC-7, Richard Secrist wrote:

I am not allowed to use a Windows install kit at work and must build
Ruby from source on Windows 7. Are there good, recent instructions on
doing this? I also need to minimize any gcc/MinGW/Cygwin influences
even at runtime so I don’t have to build those from source too. My
target is to use WATIR with an IE browser through the Selenium
IEDriverServer so I need to keep that working, but I could jettison
other stuff from the pom if I need to. Any insight on doing such things
is greatly appreciated!

If you download the source, cd to the “win32” directory and take a look
at
the README.win32 file. Or, just run win32\configure.bat
–prefix=c:/your_ruby, nmake, nmake install.

You will have to build the zlib extension from source, or use the
pr-zlib
gem, if you want to use rubygems. Building from source will require
using a
Visual Studio solution (.sln) that comes with the zlib source in the
win32
subdirectory (iirc).

One trick is that you will need to remove the ZLIB_WINAPI preprocessor
directive first. Copy the resulting .lib and .dll files somewhere handy
(like c:/usr/zlib/lib, and possibly also c:/your_ruby/bin), along with
the
.h files (like c:/usr/zlib/include), and then cd back into the ruby
source,
under ext/zlib. Run “ruby extconf.rb --with-zlib-dir=c:/usr/zlib” (or
wherever you put it), nmake, nmake install.

You may need to rename the .dll and .lib files back to “zlib.dll” and
“zlib.lib” first, as the zlib folks keep messing with the resulting file
names for odd reasons, so the ruby extconf.rb script might not pick it
up.

Building openssl should be easier. Just put the source in a simple
location
(c:/usr/openssl), cd to the ext/openssl subdirectory in the ruby source
code, and run “ruby extconf.rb --with-openssl-dir=c:/usr/openssl; nmake;
nmake install”.

Hope that helps.

Dan

Thank you for your excellent post on 2/18 Dan, which was quite helpful!
When I get to the “ruby extconf.rb --with-zlib-dir=C:\zlib-1.2.8” step
however I get:

checking for deflateReset() in z.lib…
C:/ruby-1.9.3-p545/install/lib/ruby/1.9.1/mkmf.rb:381:in `try_do’: The
compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.

If I try to install the DevKit from the Rubyinstaller folks to correct
that, the “ruby dk.rb init” step dies with:

It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your
ruby.

…and I tried your libyaml blog entry
(http://djberg96.livejournal.com/180132.html) to fix that, but get the
same message.

Do you know how to plug in the DevKit on Windows to a MSVC++ build of
Ruby?

Thanks!
rcs

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs