Does anyone know a way to deploy to a server and have the native extensions installed in a user directory?
I’m using capistrano and bundler and don’t have write access to /usr/local… Gems with Native extensions (in the current case, bcrypt-ruby) don’t install. My initial problem was an inability to find “config.h.”
On some investigation of the generated Makefile, this line is the culprit:
$(OBJS): $(hdrdir)/ruby.h $(hdrdir)/ruby/defines.h $(arch_hdrdir)/ruby/config.h
Mkmf defines arch_hdrdir this way:
arch_hdrdir = $(extout)/include/$(arch)
Why it does this is a bit baffling. Unfortunately, $extout is “”, so as a result, Make is looking for config in /include/i686-linux/ruby/config.h and fails.
Further investigation into mkmf lead me to think $extout being set to something that evaluates to true in install_dirs, but ends up being an empty string in the makefile. But, I can’t figure out where it’s getting set.
To shake things up, I’ve tried setting $extout in extconf.rb. But…
1) If I set it to ‘/usr/local/lib/ruby’ the makefile tries to install the .so into /usr/local/lib/ruby… where I don’t have write access. Boo.
2) I have tried setting $extout to ‘/home/crivens/railsapp/shared/bundle’. This actually compiles, but then the application can’t find the .so file. And I had to do a bunch of hacks to get there.
After spending a bunch of time on this, I’m looking for suggestions!
- Is it even possible to install a gem with native extensions without access to the system repository?
- What would be the best strategy for doing so?
- Is mkmf documented anywhere? (I sure can’t find much of note)
- What is $extout for and how does it get set?
Thanks in advance.
I think what you’re looking for is ruby version manager (rvm). It’s available here and allows you to manage versions of Ruby, Rails, and Gem sets.
https://rvm.io/
There’s a good getting started guide here as well: http://rvm.beginrescueend.com/rvm/install/
Here’s how the install goes:
Once complete I’ve got a fully functional install of Ruby 1.9.3-p362:
Which version of Ruby?
A little Hello World
EDIT #1
Through the course of discussing this question the author, Crivens, noted that he was getting the following error:
If you encounter this error it usually means one of two things:
1. I think you’re just missing this RPM, ca-certificates-2010.63-3.el6. These are the certificates. My install of RVM on a Ubuntu 8.04.4 machine fails. Should I install it as multi-user instead?
solution #1
2. The developer for rvm, Wayne, changed the URL from rvm.beginrescueend.com to rvm.io and probably wonked the SSL certs. Curl Certificate Error when Using RVM to install Ruby 1.9.2
solution #2