Building Ruby 2.3 on Windows

I’ve spent the last couple days trying to get Ruby 2.3 to build on Windows using Visual Stuido. It’s been… Interesting to say the least.

At Spiceworks, we actually have patches of our own to apply to the Ruby source to handle some special cases around Win32 OLE (I believe one of them is actually a bug in Ruby but I haven’t been able to find anything on it). It’s been fun finding where things have changed from 2.1 to 2.3. Thankfully most things have translated fairly nicely and I’ve got Ruby compiling at this point but still struggling with trying to get it wedged into our “build” system.

The current troubles I’ve had revolve around getting rake to install to right place. Currently when running the install script I get the following problem:

  nmake DESTDIR=C:\destination\build install-nodoc

  installing default gems:      ./lib/ruby/gems/2.3.0 (build_info, cache, doc, extensions, gems, specifications)
                                bigdecimal 1.2.8
                                io-console 0.4.5
                                json 1.8.3
                                psych 2.1.0
                                rdoc 4.2.1
  installing bundle gems:       ./lib/ruby/gems/2.3.0 (build_info, cache, doc, extensions, gems, specifications)
                                did_you_mean 1.0.0
                                minitest 5.8.5
                                net-telnet 0.1.1
                                power_assert 0.2.6
                                rake 10.4.2
  C:\tools\build-artifacts\sw-platform\7.6-0\build./lib/ruby/gems/2.3.0/gems/rake-10.4.2/bin/rake maybe `gem pristine rake` will fix it?
                                test-unit 3.1.5

What appears to be happening is when the tool/rbinstall.rb script runs it calls the install method on each gem included in the build. That gets into RubyGems installer.rb which eventually gets to the generate_bin method. From what I can tell, this method simply makes sure that the the destination bin_dir (where the gems binary executables will copied/symlinked to) and bin_path (where the gems binary executables will be installed) has the proper permissions to be written to and exist.

Now the issues seems to be the that the /bin directory for rake doesn’t exist, and therefore the installation process stops. What’s weird is that if I modify that file to add the directory manually, it seems to die because directly after the script adds it, the whole thing gets wiped out from somewhere.

Not sure, where or why that’s happening but my approach is going to be two fold:

  • First, find out why the /bin wasn’t written properly in the first place. I wonder if it’s a permissions issue with directory, or if the gem isn’t able to write things and is just swallowing up the error message. This probably means diving into the gem itself but it might mean further spelunking in RubyGems

  • Second, see if I can determine why when I add the the /bin folder manually it gets wiped out. Ideally, the first step solves the second, but I’m confused as to why the directory is getting wiped.

In either case, I’m trying to avoid modifying the Ruby source any further.

 Avatar

Assembled by Jon Grimes

Programming language, pizza and wine enthusiast

Subscribe via RSS or browse source on GitHub.