我认为我之前的问题表述得有些糟糕。
我在运行 ruby 和 mongrel 服务器的 CentOS 系统上遇到了问题,该系统在操作系统更新后出现故障。
编辑:初始问题已解决。但启动服务器仍然无法正常工作:
./script/server
/usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require': iconv will be deprecated in the future, use String#encode instead.
=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails 2.2.2 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:142:in `load': cannot load such file -- mongrel_rails (LoadError)
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:142:in `block in load_with_new_constant_marking'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:142:in `load_with_new_constant_marking'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/rails-2.2.2/lib/commands/servers/mongrel.rb:64:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `block in require'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require'
from /usr/local/rvm/gems/ruby-1.9.3-p392/gems/rails-2.2.2/lib/commands/server.rb:49:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from ./script/server:3:in `<main>'
应用程序要求使用 Rails 2.2.2。我知道它太旧了,但现在我只想让它再次运行,然后再考虑升级。
尝试安装 mongrel 如下所示:
gem install mongrel
Building native extensions. This could take a while...
ERROR: Error installing mongrel:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.3-p392/bin/ruby extconf.rb
checking for main() in -lc... yes
creating Makefile
make
compiling http11_parser.c
http11_parser.rl: In Funktion »http_parser_execute«:
http11_parser.rl:105: Warnung: Vergleich zwischen vorzeichenbehafteten und vorzeichenlosen Ganzzahlausdrücken
compiling http11.c
http11.c: In Funktion »http_field«:
http11.c:77: Fehler: »struct RString« hat kein Element namens »ptr«
http11.c:77: Fehler: »struct RString« hat kein Element namens »len«
http11.c:77: Warnung: linker Operand des Komma-Ausdrucks hat keinen Effekt
http11.c: In Funktion »header_done«:
http11.c:172: Fehler: »struct RString« hat kein Element namens »ptr«
http11.c:172: Fehler: »struct RString« hat kein Element namens »ptr«
http11.c:172: Fehler: »struct RString« hat kein Element namens »ptr«
http11.c:174: Fehler: »struct RString« hat kein Element namens »ptr«
http11.c:176: Fehler: »struct RString« hat kein Element namens »ptr«
http11.c:177: Fehler: »struct RString« hat kein Element namens »len«
http11.c: In Funktion »HttpParser_execute«:
http11.c:298: Fehler: »struct RString« hat kein Element namens »ptr«
http11.c:299: Fehler: »struct RString« hat kein Element namens »len«
make: *** [http11.o] Fehler 1
Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p392/gems/mongrel-1.1.5 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p392/gems/mongrel-1.1.5/ext/http11/gem_make.out
答案1
Mongrel 与 Ruby > 1.9.1 不兼容,而且不再维护。你确实不应该使用它。
您的选择是:
- 切换到另一台服务器。Thin 是通常推荐的继任者,因为它基于 mongrel. (可能是您的最佳选择。)
- 使用解决方法强制 Mongrel 进行编译。这并不能保证它确实会工作, 尽管...