Wednesday, 26 September 2007

Mongrel on Solaris 10, no C compiler

I've installed Coolstack's Ruby package and some gems on a T2000 box, including Mongrel and its dependencies. However, when I tried to start Mongrel it failed with an error:
in `require__': no such file to load -- http11 (LoadError)
It took me a while to figure-out what was wrong because `gem install mongrel' shows a false success message:
Successfully installed mongrel, version 1.0.1

Searching around, some threads pointed to a problem with rbconfig.rb, but this was not my problem; there was a library missing:

# ls -al
/opt/coolstack/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/ No such file or directory
This box doesn't have make, a C compiler or other build tools so, obviously, the installation wasn't able to create I just wish it had failed instead of giving me false hope.

I got around it by building it on another machine with the same architecture (sparc, in my case) and compiling tools:
  1. Copy to your build host the directory /opt/coolstack/lib/ruby/gems/1.8/gems/mongrel-1.0.1/ext/http11
  2. To the same destination, copy /opt/coolstack/lib/ruby/1.8/sparc-solaris2.10/*.h and /opt/coolstack/lib/
  3. On the build host, under the http11 directory, run `make'.
  4. You should now have a on the build host. Copy it to the original machine under /opt/coolstack/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib
Another option, if you have root access to the build host, is simpy installing mongrel over there and then copying the library over to the other host. YMMV.

This guy has a neat guide to installing Mongrel on a shared host. It may also help you. G'luck.

No comments: