ruby-1.9.1でmongrelのインストール
Revactorをmongrelで動かしたかったので、gemからインストールしようとすると、以下のようにエラーとなってしまう
$ > ruby19 -v ruby 1.9.1p0 (2009-01-30 revision 21907) [i686-linux] $ > sudo gem19 install mongrel -- --disable=fastthread Building native extensions. This could take a while... ERROR: Error installing mongrel: ERROR: Failed to build gem native extension. /usr/local/share/ruby191p0/bin/ruby extconf.rb install mongrel -- --disable=fastthread creating Makefile make gcc -I. -I/usr/local/share/ruby191p0/include/ruby-1.9.1/i686-linux -I/usr/local/share/ruby191p0/include/ruby-1.9.1/ruby/backward -I/usr/local/share/ruby191p0/include/ruby-1.9.1 -I. -D_FILE_OFFSET_BITS=64 -fPIC -O2 -g -Wall -Wno-parentheses -o fastthread.o -c fastthread.c fastthread.c:13:20: error: intern.h: No such file or directory fastthread.c:14 から include されたファイル中: /usr/local/share/ruby191p0/include/ruby-1.9.1/ruby/backward/rubysig.h:14:2: 警告: #warning rubysig.h is obsolete fastthread.c:349: error: static declaration of ‘rb_mutex_locked_p’ follows non-static declaration /usr/local/share/ruby191p0/include/ruby-1.9.1/ruby/intern.h:707: error: previous declaration of ‘rb_mutex_locked_p’ was here fastthread.c:366: error: static declaration of ‘rb_mutex_try_lock’ follows non-static declaration /usr/local/share/ruby191p0/include/ruby-1.9.1/ruby/intern.h:708: error: previous declaration of ‘rb_mutex_try_lock’ was here fastthread.c: In function ‘lock_mutex’: fastthread.c:392: error: ‘rb_thread_critical’ undeclared (first use in this function) fastthread.c:392: error: (Each undeclared identifier is reported only once fastthread.c:392: error: for each function it appears in.) fastthread.c: トップレベル: fastthread.c:406: error: static declaration of ‘rb_mutex_lock’ follows non-static declaration /usr/local/share/ruby191p0/include/ruby-1.9.1/ruby/intern.h:709: error: previous declaration of ‘rb_mutex_lock’ was here fastthread.c: In function ‘set_critical’: fastthread.c:438: error: ‘rb_thread_critical’ undeclared (first use in this function) fastthread.c: In function ‘unlock_mutex’: fastthread.c:447: error: ‘rb_thread_critical’ undeclared (first use in this function) fastthread.c: トップレベル: fastthread.c:463: error: static declaration of ‘rb_mutex_unlock’ follows non-static declaration /usr/local/share/ruby191p0/include/ruby-1.9.1/ruby/intern.h:710: error: previous declaration of ‘rb_mutex_unlock’ was here fastthread.c: In function ‘rb_mutex_exclusive_unlock’: fastthread.c:499: error: ‘rb_thread_critical’ undeclared (first use in this function) fastthread.c: トップレベル: fastthread.c:524: error: conflicting types for ‘rb_mutex_synchronize’ /usr/local/share/ruby191p0/include/ruby-1.9.1/ruby/intern.h:712: error: previous declaration of ‘rb_mutex_synchronize’ was here fastthread.c: In function ‘wait_condvar’: fastthread.c:620: error: ‘rb_thread_critical’ undeclared (first use in this function) fastthread.c:626: 警告: passing argument 1 of ‘rb_ensure’ from incompatible pointer type fastthread.c: In function ‘rb_condvar_broadcast’: fastthread.c:684: error: ‘rb_thread_critical’ undeclared (first use in this function) fastthread.c: In function ‘signal_condvar’: fastthread.c:703: error: ‘rb_thread_critical’ undeclared (first use in this function) fastthread.c: In function ‘rb_queue_marshal_load’: fastthread.c:824: error: ‘struct RArray’ has no member named ‘len’ fastthread.c:828: error: ‘struct RArray’ has no member named ‘ptr’ fastthread.c:828: error: ‘struct RArray’ has no member named ‘len’ fastthread.c: In function ‘Init_fastthread’: fastthread.c:1182: error: ‘rb_thread_critical’ undeclared (first use in this function) make: *** [fastthread.o] エラー 1 Gem files will remain installed in /usr/local/share/ruby191p0/lib/ruby/gems/1.9.1/gems/fastthread-1.0.1 for inspection. Results logged to /usr/local/share/ruby191p0/lib/ruby/gems/1.9.1/gems/fastthread-1.0.1/ext/fastthread/gem_make.out
ここ->Mongrel and fastthread on ruby 1.9? - Mongrel - Ruby-Forumで問題になっているのと同じこと。fastthreadいらないよーということらしい。mongrelの依存関係を記述しているところを探せばなんとかなるだろう、ということで
$ > git clone git://github.com/mongrel/mongrel.git mongrel $ > cd mongrel $ > vim Rakefile #33〜47行目 p.eval = proc do case RUBY_PLATFORM when /mswin/ self.files += ['lib/http11.so'] self.platform = Gem::Platform::CURRENT add_dependency('cgi_multipart_eof_fix', '>= 2.4') when /java/ self.files += ['lib/http11.jar'] self.platform = 'jruby' # XXX Is this right? else add_dependency('daemons', '>= 1.0.3') # add_dependency('fastthread', '>= 1.0.1') add_dependency('cgi_multipart_eof_fix', '>= 2.4') end end
add_dependency('fastthread', '>= 1.0.1')の行をコメントアウト。でgemパッケージを作成する。
$ > sudo rake package (中略) Successfully built RubyGem Name: mongrel Version: 1.1.2 File: mongrel-1.1.2.gem mv mongrel-1.1.2.gem pkg/mongrel-1.1.2.gem Private key not found; gem will not be signed. Targeting "ruby" platform. $ > sudo gem19 install mongrel --local Building native extensions. This could take a while... Successfully installed mongrel-1.1.2 1 gem installed Installing ri documentation for mongrel-1.1.2... Updating class cache with 1322 classes... Installing RDoc documentation for mongrel-1.1.2... $ > gem19 list --local *** LOCAL GEMS *** activesupport (2.2.2) case (0.5) cgi_multipart_eof_fix (2.5.0) daemons (1.0.10) gem_plugin (0.2.3) hoe (1.8.3) mongrel (1.1.2) rake (0.8.3) rev (0.2.3) revactor (0.1.4) rubigen (1.5.2) rubyforge (1.0.2)
さて、インストールが終わった模様だが、ちゃんと動くだろうか。あとで試す。間違い、勘違い等あればツッコミよろしくお願いします。