Skip to content

Instantly share code, notes, and snippets.

@mnylen
Created January 5, 2011 13:21
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mnylen/766300 to your computer and use it in GitHub Desktop.
Save mnylen/766300 to your computer and use it in GitHub Desktop.
How to get RVM + Subversion Ruby Bindings to work
$ rvm use 1.8.7-p302
$ wget http://subversion.tigris.org/downloads/subversion-1.6.15.tar.gz
$ tar -xzf subversion-1.6.15.tar.gz && cd subversion-1.6.15
$ ./configure --with-ruby-sitedir=~/.rvm/rubies/ruby-1.8.7-p302/lib/ruby --without-berkeley-db
$ make swig-rb && make install-swig-rb
To test things out:
$ irb
ruby-1.8.7-p302 > require 'svn/client'
=> true
ruby-1.8.7-p302 > exit
To install RVM:
$ sudo apt-get install build-essential curl git-core ruby
$ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
$ echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session' >> ~/.profile
$ source ~/.profile
$ rvm package install readline
$ rvm package install zlib
$ rvm install 1.8.7 --with-zlib-dir=/home/you/.rvm/usr --with-readline-dir=/home/you/.rvm/usr
$ rvm --default 1.8.7
Now the bindings
$ sudo apt-get install libsvn-ruby
$ cd /usr/lib/ruby/1.8
$ cp -R svn /home/you/.rvm/rubies/default/lib/ruby/1.8
$ cp -R x86_64-linux/svn /home/you/.rvm/rubies/default/lib/ruby/1.8/x86_64-linux/
To test things out:
$ irb
ruby-1.8.7-p330 :001 > require 'svn/client'
=> true
ruby-1.8.7-p330 :002 > exit
@mnylen
Copy link
Author

mnylen commented Jan 5, 2011

malloc's instructions are for Ubuntu 10.10 64-bit edition, while the original gist is for OS X Snow Leopard.

@mnylen
Copy link
Author

mnylen commented Jan 5, 2011

You also need to do sudo apt-get install libsvn-dev in order to compile Subversion on Ubuntu.

@assimovt
Copy link

Thanks :)

@sgronblo
Copy link

After spending a few hours trying to figure out what would be the cleanest way to enable the rvm ruby to use the svn bindings I finally gave up and used Mikko's solution. Well I didn't copy the folders, I just symlinked them.

I noticed there was a swig-related file in /usr/lib/libsvn_swig_ruby-1.so.1.0.0 that apparently is not necessary for the svn bindings to work in rvm.

I noticed that subversion's configure --help mentioned that the ruby bindings should be installed to the ruby installation's sitedir. This would allow you to specify --with-sitedir=SYSTEM_SITEDIR when compiling the ruby version using rvm. However some guy told me in #ubuntu that apt-get should not touch /usr/local and true to this apt-get does not install the libsvn-ruby1.8 package to your sitedir as subversion's INSTALL recommends but instead into your system ruby's libdir.

I'm not sure if it would be all right to just provide the --libdir=SYSTEM_RUBY_LIBDIR when compiling your rvm ruby or if that may cause problems if you are trying to install a slightly different version than the system ruby.

Another option might be if rvm could just check out the part of subversion's repository that deals with making the bindings and then figure out that you have subversion installed (well maybe you would need some sort of libsvndev package I dont know) and create the bindings to point to that and finally place them in your rvm-compiled ruby's sitedir.

@sgronblo
Copy link

Another small thing when I did this again. The architecture specific files where found in i686-linux for me instead of x86_64-linux.

@archite
Copy link

archite commented Sep 15, 2011

I found this command worked for me on OS X Lion:

env CC=gcc-4.2 LDFLAGS="-L$MY_RUBY_HOME/lib" ./configure --with-ruby-sitedir=$MY_RUBY_HOME/lib/ruby --without-berkeley-db

@joustava
Copy link

joustava commented Nov 9, 2011

Thanks mate, you saved my day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment