Using Mongrel with Ruby 1.9.2

**  Update ** for the time being, I’m disabling all of the commenting functionality on my posts because of terrible amounts of spam circumventing my captcha.  If you need to contact me for a question in particular, please reach me at kevin at h-pk-ns.com.  Thanks!

 

So I’ve been working recently on a Rails application and am using Ruby 1.9.2 and Rails 3.0.7 for development. For some reason, not sure why, I just really don’t like WEBrick. It just seems slower overall so I greatly prefer using Mongrel or Thin.

Trying to install mongrel though, gave me a bit of a pain at first.
gem install mongrel simply just does not work anymore. It spits out:

Building native extensions. This could take a while...
ERROR: Error installing mongrel:
ERROR: Failed to build gem native extension.

/Users/Kevin/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
checking for main() in -lc... yes
creating Makefile

make
gcc -I. -I/Users/Kevin/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/x86_64-darwin10.8.0 -I/Users/Kevin/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/ruby/backward -I/Users/Kevin/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -fno-common -pipe -o http11.o -c http11.c
http11.c: In function ‘http_field’:
http11.c:70: warning: format not a string literal and no format arguments
http11.c:71: warning: format not a string literal and no format arguments
http11.c:77: error: ‘struct RString’ has no member named ‘ptr’
http11.c:77: error: ‘struct RString’ has no member named ‘len’
http11.c:77: warning: left-hand operand of comma expression has no effect
http11.c: In function ‘request_uri’:
http11.c:102: warning: format not a string literal and no format arguments
http11.c: In function ‘fragment’:
http11.c:113: warning: format not a string literal and no format arguments
http11.c: In function ‘request_path’:
http11.c:124: warning: format not a string literal and no format arguments
http11.c: In function ‘query_string’:
http11.c:135: warning: format not a string literal and no format arguments
http11.c: In function ‘header_done’:
http11.c:172: error: ‘struct RString’ has no member named ‘ptr’
http11.c:174: error: ‘struct RString’ has no member named ‘ptr’
http11.c:176: error: ‘struct RString’ has no member named ‘ptr’
http11.c:177: error: ‘struct RString’ has no member named ‘len’
http11.c: In function ‘HttpParser_execute’:
http11.c:298: error: ‘struct RString’ has no member named ‘ptr’
http11.c:299: error: ‘struct RString’ has no member named ‘len’
http11.c:307: warning: format not a string literal and no format arguments
make: *** [http11.o] Error 1

Gem files will remain installed in /Users/Kevin/.rvm/gems/ruby-1.9.2-p290@camDon/gems/mongrel-1.1.5 for inspection.
Results logged to /Users/Kevin/.rvm/gems/ruby-1.9.2-p290@camDon/gems/mongrel-1.1.5/ext/http11/gem_make.out

 

Ruby 1.9.2 requires the edge version of mongrel which can simply be installed by using gem install mongrel --pre

You’re then greeted by this wonderful little snippet:
Building native extensions. This could take a while...
Successfully installed mongrel-1.2.0.pre2
1 gem installed

Running “rails server” after this though still loads up WEBrick! I figure since Bundler does control the world now, I head over to my Gemfile and add in this line:

gem 'mongrel', '>= 1.2.0.pre2'

Following up with a quick ‘bundle install’ it looks like things are in great shape. I spool up my server with a quick ‘rails s’ and Voila!
=> Booting Mongrel
=> Rails 3.0.7 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server

Hope this helps out!

No related posts.

About Kevin L. Hopkins

Software developer (web, mobile, and desktop) located in Harrisonburg, VA. Employed as lead developer and systems administrator at Found Design + Interactive. Language polyglot, but focus on Ruby, Javascript, Actionscript 3.0 and C# using different frameworks for different tasks. View all posts by Kevin L. Hopkins

4 Responses to “Using Mongrel with Ruby 1.9.2”

SEO Powered by Platinum SEO from Techblissonline

Kevin's Blog is Stephen Fry proof thanks to caching by WP Super Cache