Skip to content

Using Native Bindings with Ruby Enterprise Edition

I recently started using Passenger and Ruby Enterprise Edition to run my Rails apps.

“It was just another day at the office, until suddenly…” I wanted to run Warehouse. It turns out that things get (just) slightly hairy when you need to use the native bindings for a library, in this case Subversion/SWIG.

I ran rake warehouse:bootstrap without incident, but as soon as I submitted the ‘install’ form, it died. This is what I found in the log:

ActionView::TemplateError (/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:478:in `const_missing': uninitialized constant Repository::Svn) on line #23 of repositories/index.html.erb:
  • 21: <%= link_to h(, hosted_url(repo, :admin) %> 22: <%= repo.path %> 23: <% if repo.sync? %> 24: <% unless repo.sync_progress == 100 %> 25: 26:
    /srv/rails/entp-warehouse-78376218f92e6bdf8b72993d9caa384e5d4a5c66/vendor/plugins/expiring_attr_reader/lib/expiring_attr_reader.rb:32:in `silo' /srv/rails/entp-warehouse-78376218f92e6bdf8b72993d9caa384e5d4a5c66/app/models/repository.rb:137:in `retrieve_silo' (eval):1:in `silo' /srv/rails/entp-warehouse-78376218f92e6bdf8b72993d9caa384e5d4a5c66/app/models/repository.rb:100:in `eval' /srv/rails/entp-warehouse-78376218f92e6bdf8b72993d9caa384e5d4a5c66/vendor/plugins/expiring_attr_reader/lib/expiring_attr_reader.rb:32:in `silo' /srv/rails/entp-warehouse-78376218f92e6bdf8b72993d9caa384e5d4a5c66/app/models/repository.rb:100:in `sync?' /srv/rails/entp-warehouse-78376218f92e6bdf8b72993d9caa384e5d4a5c66/app/views/repositories/index.html.erb:23:in `_run_erb_47app47views47repositories47index46html46erb' /srv/rails/entp-warehouse-78376218f92e6bdf8b72993d9caa384e5d4a5c66/app/views/repositories/index.html.erb:19:in `each' /srv/rails/entp-warehouse-78376218f92e6bdf8b72993d9caa384e5d4a5c66/app/views/repositories/index.html.erb:19:in `_run_erb_47app47views47repositories47index46html46erb' ...
  • Naturally I had installed the bindings using sudo apt-get install libsvn-ruby1.8 so they were available to the default Ruby (located in /usr/lib/ruby), but not Ruby Enterprise Edition (located in /opt/ruby-enterprise), which the application runs on.

    My solution was to simply symlink the Subversion bindings into Ruby Enterprise Edition. A quick look in the libsvn-ruby package (sudo dpkg -L libsvn-ruby1.8) shows us what we’re dealing with:


    The key directories are: /usr/lib/ruby/1.8/i486-linux/svn and /usr/lib/ruby/1.8/svn. So we’ll make them available to /opt/ruby-enterprise like so:

    cd /opt/ruby-enterprise/lib/ruby/1.8
    sudo ln -s /usr/lib/ruby/1.8/svn
    cd /opt/ruby-enterprise/lib/ruby/site_ruby/1.8/i686-linux
    sudo ln -s /usr/lib/ruby/1.8/i486-linux/svn

    After that, just restart Apache (apache2ctl restart), and it should be working. Note, a simple touch tmp/restart.txt won’t work, because that doesn’t reload the libraries. You actually need the /opt/ruby-enterprise/ruby process to restart.

    Theoretically this same approach should work for any native bindings you need to be available to Ruby Enterprise Edition.

    Posted in Linux, Rails, Ruby, Subversion, Tips and Tricks, Ubuntu.

    Tagged with , , , , , , , .

    2 Responses

    Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

    1. Cody says

      Thank you, this post helped me out!

    2. Roy says

      I had the exact same problem and this helped me out a lot. Thanks!

    Some HTML is OK

    or, reply to this post via trackback.