How to Install - rocky/rb-threadframe GitHub Wiki

How to build and install rb-threadframe

Check The Ruby 1.9 Debugger Project to see if there is already a package made for your OS.

Many people use rvm to allow multiple versions of Ruby and gems to coexist.

If you have rvm installed and want to try several steps in one shot, then run:

  $ bash < <( curl http://ruby-19-debugger.googlecode.com/git/patches/scripts/rvm-install-tf )
  $ rvm use ruby-1.9.3-p374-ndebugger
  $ gem install rb-threadframe

If the above works, you are done! Otherwise proceed below…

0. Prerequisites

First, here is a list of the software you’ll need to have installed:

  • gcc (I’ve not tried any other compiler)
  • git and access to github
  • svn for Ruby 1.9 (although in theory there are git mirrors)
  • autoconf (to create the configure shell script) and patch (to install patches to Ruby)
  • GNU make
  • GNU patch
  • POSIX shell, e.g. bash. Some common Unix commands: cp and mv.
  • Your /bin/sh should be bash, not dash (/bin/dash).

Note: I’ve tested this only on Ubuntu, OSX, Solaris, and cygwin.

1. Get a copy of rb-threadframe which has ruby patches

  $ build_parent_dir=${rvm_src_path:-/tmp}  # adjust as desired
  $ cd $build_parent_dir
  $ git clone https://code.google.com/p/ruby-19-debugger

Note: Don’t try to build rb-threadframe just yet.

2. Make a patched Ruby

2a. Check out Ruby 1.9.3

Note that only Ruby 1.9.3 or 1.9.2 will work. For 1.9.2 see older revisions of this document.

  $ cd $build_parent_dir && svn co http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_3 ruby-1.9.3
  A    ruby-1.9.3/complex.c
  A    ruby-1.9.3/goruby.c
  A    ruby-1.9.3/regparse.c
  A    ruby-1.9.3/README.EXT
  ...

2b. Patch Ruby

Note: the patch file seems to have conventions that work best on GNU patch as opposed to the native patch on Solaris. Set environment variable PATCH to the GNU patch program installed on your system, e.g. gpatch, if needed??

  $ cd $build_parent_dir/ruby-1.9.3
  $ bash ../ruby-19-debugger/scripts/patches/patch-ruby.sh
  patching file include/ruby/ruby.h
  patching file insns.def
  patching file vm_core.h
  ...
  Hunk #2 succeeded at 3755 (offset 5 lines).  # you may see lines like this
  ...

It is possible that patching may fail. A failed patch message looks like this:

Hunk #1 FAILED at 1341.
1 out of 1 hunk FAILED -- saving rejects to file xxx.rej

ONLY if you get a patch failure like the above:

  $ cd $build_parent_dir/rb-threadframe/patches
  $ rev=374
  $ cd $build_parent_dir && svn co -r $rev http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_3 ruby-1.9.3-p$rev
  A    ruby-1.9.3-p374/complex.c
  A    ruby-1.9.3-p374/goruby.c
  A    ruby-1.9.3-p374/regparse.c
  A    ruby-1.9.3-p374/README.EXT
  ...

And then follow the instructions at the beginning of this section, Section 2b: Patch Ruby.

3. Build and Install Patched Ruby 1.9

If you have rvm installed…

Make sure rvm_rubies_path is defined. If not set it.

 $ echo $rvm_rubies_path
 /home/rocky/.rvm/rubies  # 
 # if not set...
 $ rvm_rubyies_path=~/.rvm/rubies
  $ cd $build_parent_dir/ruby-1.9.3
  # If there is no configure file yet...
  $ autoconf
  # I like to build without C optimization initially. Consider adding -O3
  $ CFLAGS='-g3 -Wall' sh ./configure --prefix=$rvm_rubies_path/ruby-1.9.3-p374 && make main # see also "make help"
  $ make check # fails in test_io on cygwin
  $ make install-nodoc  # Don't bother with RDOC or RI
  $ rvm use ruby-1.9.3-p374-nframe

Skip to Step 4: Build and Install the rb-threadframe Gem

If you don’t have rvm installed…

  $ cd $build_parent_dir/ruby-1.9.3
  # I like to build without C optimization initially. Consider adding -O3
  # Also consider using the --prefix for configure.
  $ CFLAGS='-g3 -Wall' sh ./configure && make main # see also "make help"
  $ make test # fails in test_io on cygwin
  $ sudo make install-nodoc  # possibly 'sudo' is optional 

4. The rb-threadframe Gem

Remember rb-threadframe? You know, the package we wanted to install?

  $ gem install rb-threadframe

Note: you may have to use “sudo rake install” below instead of “rake install”.

⚠️ **GitHub.com Fallback** ⚠️