123456789_123456789_123456789_123456789_123456789_

Ruby MinGW & MSWin Builds - Info & Usage

Overview

This document describes what builds are available and their use, both locally and on GitHub. At present, all the builds are 64 bit.

GitHub

Rolling MinGW & MSWin trunk builds are done at 3:00, 9:00 and 16:00 UTC (Noon, 6:00 P and 1:00 A JST). The most recent builds with passing tests are available in a GitHub release. The Actions page at ruby-loco has logs and artifacts.

These builds correspond to the mingw and mswin builds used on GitHub Actions when using the ruby/setup-ruby action.

Appveyor

Rolling trunk builds are done at 3:00, 9:00 and 16:00 UTC (Noon, 6:00 P and 1:00 A JST). The most recent build with passing tests is available as an Appveyor artifact at https://ci.appveyor.com/api/projects/MSP-Greg/ruby-loco/artifacts/ruby_trunk.7z. Build and test logs are an artifact in the most recent passing build shown in https://ci.appveyor.com/project/MSP-Greg/ruby-loco/history. Log files are named zlogs_trunk_YYYY-MM-DD_SVN.7z.

BinTray

A 2.3.5 build is available on Bintray:

Bundler is included, and rubygems and all bundled gems were updated at the time of build. Four extension default gems are upgraded, bigdecimal, json, openssl, and pysch. These have been pushed back into the build, so they are the default. See BinTray Release Note.

General Use

All builds utilize the runtime files from RubyInstaller2. Thanks to Lars Kanis for all his work on RubyInstaller2.

Readline

Both readline extension and rb-readline are installed. The build is tested with the extension, but the 7z file has rb-readline enabled by default. To use the extension, rename lib\ruby\site_ruby\readline.rb to lib\ruby\site_ruby\readline.rb_ (my normal convention).

MinGW Packages

Ruby trunk is built with two custom MinGW packages, GDBM 1.10 and OpenSSL 1.1.0. The trunk build has a script / cmd file named trunk_pkgs.cmd, which shows how to install both packages. Note that it assumes your MSYS2 install is at C:\msys64. Packages are normally stored in var\cache\pacman\pkg.

GDBM 1.10

This package doesn't seem to have many reverse dependencies, so you may not need to add it to your packages. The GDBM package used for these builds is available at:

OpenSSL 1.1.0f

If you're updating OpenSSL or Digest, or installing EventMachine, this package should be added. I'm sure there are gems I'm unaware of that also use it. Packages files:

lib\ruby\2.5.0\x64-mingw32\rbconfig.rb - reproducible build

At present (2017-09-27), rbconfig.rb has paths included that refer to the git.exe location. I have not taken time to determine what may use these settings outside of the build process. You may need to edit these settings to point to a correct path on your system.

Gem installation

Many gems builders support MinGW builds with binary (fat) gems. The are listed on RubyGems.org with suffixes x64-mingw32 (64 bit) and x86-mingw32 (32 bit). Since these gems link to ruby dlls, they need version specific files. Hence, almost none support trunk builds, and some don't support ruby 2.4.

Because of this, you will need to force your system to compile all extension gems that you install. I would suggest making sure that your MSYS2/MinGW files and packages are up to date.

To force compiling, I recommend adding the following to your .gemrc file, normally located in your root user folder:

---
:verbose: true
install: --no-document --env-shebang --platform ruby -- --use-system-libraries
update:  --no-document --env-shebang --platform ruby -- --use-system-libraries

I believe there should be a blank line at the end. This will force all extension gems to install using the MSYS2/MinGW system. If you want documentation, please remove the --no-document option. Some gems may require additional build options. See the RubyInstaller2 FAQ for more info. There may also be issues that discuss your 'problem gem'.

bundler install

As to a bundler install, per the RI2 FAQ (more info there), use the following command lines before install:

bundle config force_ruby_platform true
bundle config build.<name of gem> --use-system-libraries

--- Examples of some Rails extension gems (not inclusive) ---
bundle config build.eventmachine --use-system-libraries
bundle config build.nio4r        --use-system-libraries
bundle config build.nokogiri     --use-system-libraries

If you have several extension gems, the bundle config build.<gem name> command should be entered for each. As noted in the FAQ, some extension gems may require additional options, typically related to a specific MSYS2/MinGW package they require for building/compiling. Obviously, you need to install the package first, and possibly specify an option.

Important Bundler Note the .gemrc file is read by bundler, but I haven't spent a great deal of time seeing if all options are applied. If so, the bundler config commands shouldn't be needed, as the --platform ruby and -- --use-system-libraries options should be read from the .gemrc file.

Using on Appveyor

Note - if you are testing a repo that compiles using MSYS2/MinGW, information about installed packages (and several ruby versions) is shown at MSP-Greg/appveyor-ruby.

To allow a simply install when used in Appveyor, all build archieves are named r_trunk.7z. There are a few scripts included that updated packages and MSYS2/MinGW also.

The following is an example of a script that installs and updates MSYS2/MinGW:

init:
  # To avoid duplicated executables in PATH, see https://github.com/ruby/spec/pull/468
  - set PATH=C:\ruby%RUBY_VERSION%\bin;C:\Program Files\7-Zip;C:\Program Files\AppVeyor\BuildAgent;C:\Program Files\Git\cmd;C:\Windows\system32;C:\Program Files;C:\Windows
  # Loads trunk build and updates MSYS2 / MinGW to most recent gcc compiler
  - if %ruby_version%==_trunk (
      appveyor DownloadFile https://ci.appveyor.com/api/projects/MSP-Greg/ruby-loco/artifacts/ruby_trunk.7z -FileName C:\ruby_trunk.7z &
      7z x C:\ruby_trunk.7z -oC:\ruby_trunk & C:\ruby_trunk\trunk_msys2.cmd)

environment:
  matrix:
    - RUBY_VERSION: 23-x64
    - RUBY_VERSION: 24-x64
    - RUBY_VERSION: _trunk

init: section

A URI like https://ci.appveyor.com/api/projects/MSP-Greg/ruby-loco/artifacts/<file name> will download the most recent artifact with the given name from all build jobs.

Note the & C:\ruby_trunk\trunk_msys2.cmd. This runs the trunk_msys2.cmd script after trunk has been installed.

included scripts

Compiling on Appveyor

All ruby builds used on Appveyor will set the corrects paths for compiling when -rdevkit is added to most ruby based shell commands.