If you’re using rbenv and ruby-build on a Linux that has updated to glibc 2.14 or newer, you may have encountered an error like this when attempting to build an older version of MRI:
The issue isn’t specific to ruby-build or rbenv, but rather is an issue with building Ruby after upgrading glibc to 2.14:
This is caused by the fact that the generated file callback.func is corrupt. The corruption is triggered by a recent glibc change:
which was to fix a POSIX compatibility issue:
Patches are provided to manually patch the Ruby source before building, but what if you’re using something like rbenv and ruby-install, instead of building Ruby manually?
This Gist, from GitHub user kungfoo, provides a ruby-build definition for building Ruby 1.8.7-p358 with the required patch for building on a system with the updated glibc.
To date, I had only used rbenv and ruby-build to build Rubies from ruby-build’s included definitions. Turns out, it’s quite easy to use this definition, once I realized that that’s what this was.
Simply do the following:
$ vim /tmp/1.8.7-p358-with-rogue-stdout-patch ... paste contents of Gist into file, save and exit ... $ rbenv install /tmp/1.8.7-p358-with-rogue-stdout-patch
Note, the filename will be the name that rbenv uses to identify this Ruby, so if you don’t want the name to be “1.8.7-p358-with-rogue-stdout-patch”, name the file to match the name you prefer.