pirosikick's diary

君のハートにunshift

mongrelインストール

環境

$ ruby -v
ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-linux]

$ rails -v
Rails 3.0.3

インストール

mongrelをインストールしようとしたら下記エラーが発生。

$ sudo gem install mongrel
[sudo] password for hanai: 
Building native extensions.  This could take a while...
Building native extensions.  This could take a while...
ERROR:  Error installing mongrel:
        ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb
checking for main() in -lc... yes
creating Makefile

make
gcc -I. -I/usr/include/ruby-1.9.1/x86_64-linux -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I.   -fPIC -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long  -o http11.o -c http11.c
http11.c: In function ‘http_field’:
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 ‘header_done’:
http11.c:172: error: ‘struct RString’ has no member named ‘ptr’
http11.c:172: error: ‘struct RString’ has no member named ‘ptr’
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’
make: *** [http11.o] Error 1

ググって、API Only - Stack Exchangeにたどり着く

You can install mongrel 1.2 prerelease with sudo gem install mongrel --pre

    • preを付けて、再実行。
$ sudo gem install mongrel --pre
Building native extensions.  This could take a while...
Successfully installed daemons-1.0.10
Successfully installed mongrel-1.2.0.pre2
2 gems installed
Installing ri documentation for daemons-1.0.10...
Installing ri documentation for mongrel-1.2.0.pre2...
Installing RDoc documentation for daemons-1.0.10...
Installing RDoc documentation for mongrel-1.2.0.pre2...

OK!!

起動

$ mongrel_rails start
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
/usr/lib/ruby/gems/1.9.1/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require': no such file to load -- dispatcher (LoadError)
        from /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `block in require'
        from /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `block in load_dependency'
        from /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:596:in `new_constants_in'
        from /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:225:in `load_dependency'
        from /usr/lib/ruby/gems/1.9.1/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require'
        from /usr/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2/lib/mongrel/rails.rb:148:in `rails'
        from /usr/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2/bin/mongrel_rails:116:in `block (2 levels) in run'
        from /usr/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2/lib/mongrel/configurator.rb:149:in `call'
        from /usr/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2/lib/mongrel/configurator.rb:149:in `listener'
        from /usr/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2/bin/mongrel_rails:102:in `block in run'
        from /usr/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2/lib/mongrel/configurator.rb:50:in `call'
        from /usr/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2/lib/mongrel/configurator.rb:50:in `initialize'
        from /usr/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2/bin/mongrel_rails:86:in `new'
        from /usr/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2/bin/mongrel_rails:86:in `run'
        from /usr/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2/lib/mongrel/command.rb:210:in `run'
        from /usr/lib/ruby/gems/1.9.1/gems/mongrel-1.2.0.pre2/bin/mongrel_rails:282:in `<top (required)>'
        from /usr/bin/mongrel_rails:19:in `load'
        from /usr/bin/mongrel_rails:19:in `<main>'

おっと。。。

rails server (or rails s)使えってことらしい。

書き留めておくところ: 12月 2010

rails serverで起動

$ rails server mongrel 
=> Booting Mongrel
=> Rails 3.0.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server

OK!!!