宝石安装杂种失败与红宝石1.9.1 [英] gem install mongrel fails with ruby 1.9.1
问题描述
我昨天发起了自己的rails开发。
我安装了ruby 1.9.1,rubygems和rails。
运行 gem install mongrel
表现良好,表面上也安装了杂种。我有点困惑,因为:
哪个mongrel
不会返回任何内容
locate mongrel
会返回大量条目,例如
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr /lib/ruby/gems/1.8/gems/mongrel-1.0.1
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby /gems/1.8/gems/mongrel-1.0.1/lib
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems /1.8/gems/mongrel-1.0.1/lib/mongrel
。
。
。
/ usr / local / bin / mongrel_rails
/usr/local/lib/ruby/gems/1.9.1/cache/mongrel-1.1.5.gem
/ usr / local / lib /ruby/gems/1.9.1/doc/actionpack-2.3.2/rdoc/files/lib/action_controller/vendor/rack-1_0/rack/handler/evented_mongrel_rb.html
/ usr / local / lib / ruby /gems/1.9.1/doc/actionpack-2.3.2/rdoc/files/lib/action_controller/vendor/rack-1_0/rack/handler/mongrel_rb.html
/ usr / local / lib / ruby / gems /1.9.1/doc/actionpack-2.3.2/rdoc/files/lib/action_controller/vendor/rack-1_0/rack/handler/swiftiplied_mongrel_rb.html
/usr/local/lib/ruby/gems/1.9 .1 / gems / actionpack-2.3.2 / lib / action_controller / vendor / rack-1.0 / rack / handler / evented_mongrel.rb
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack -2.3.2 / lib / action_controller / vendor / rack-1.0 / rack / handler / mongrel.rb
/usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib /action_controller/vendor/rack-1.0/rack/handler/swiftiplied_mongrel.rb
/usr/local/lib/ruby/gems/1.9.1/gems/mongrel-1.1.5
。
。
。
看起来我已经安装了mongrel(默认安装和我的自定义安装)。那么为什么没有哪个杂种返回什么。
同样尝试使用 gem install mongrel
来重新安装mongrel,自己的例外情况:
构建原生扩展。这可能需要一段时间...
错误:安装mongrel时出错:
错误:无法构建gem原生扩展。
/ usr / local / bin / ruby extconf.rb安装mongrel
检查main()in -lc ... yes
创建Makefile
使
gcc -I。 -I / usr / local / include / ruby-1.9.1 / i386-darwin9.7.0 -I / usr / local / include / ruby-1.9.1 / ruby / backward -I / usr / local / include / ruby-1.9 .1 -I。 -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -D_XOPEN_SOURCE = 1 -O2 -g -Wall -Wno-括号-fno-common -pipe -fno-common -o http11.o -c http11.c
http11.c:在函数'http_field'中:
http11.c:77:错误:'struct RString'没有名为'ptr'的成员
http11.c:77:error:'struct RString'has no member named' len'
http11.c:77:警告:逗号表达式的左侧操作数没有作用
http11.c:77:warning:语句无效
http11.c:函数中的函数'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:在函数'HttpParser_execute'中:
http11.c:298:error:'struct RString'has no members named'ptr'
http11.c:299:error:'struct RString'没有名为'len'的成员
make:*** [http11.o]错误1
看起来像其他人正在运行Mongrel的问题在Ruby 1.9上。
Ami Mahloof的评论似乎可能是一个可能的解决方案:
以下是您需要做的以便修复它的方法
以下是更新后的说明:
<1> cd /usr/local/lib/ruby/gems/1.9.1/gems/mongrel-1.1.5/ext/http11
2)sudo vi / mate on http11.c和:
替换第77行为
ch = RSTRING_PTR(f),end = ch + RSTRING_LEN(f); ch <结束; (RSTRING_PTR(temp),':'){b / b> ;
将行174替换为
rb_hash_aset(req,global_server_name,rb_str_substr(temp,0,colon - RSTRING_PTR (temp)));
replce line 176,177
rb_str_substr(temp,colon - RSTRING_PTR(temp)+ 1,
RSTRING_LEN(temp)));
替换行298 299
dptr = RSTRING_PTR (data);
dlen = RSTRING_LEN(data);
3)保存文件,关闭vi / textmate
4)sudo ruby extconf.rb&& sudo make&& sudo make install
5)cd ../../lib/mongrel
(或者完整路径/ usr / local / lib / ruby / gems /1.9.1/gems/mongrel-1.1.5/lib/mongrel
6)mate / sudo vi handlers.rb
$
$ b在第208-212行,将:false的实例更改为then false
8)sudo gem install gem_plugin(否则mongrel可能会挂起)
完成!
blockquote>I initiated myself into rails development yesterday.
I installed ruby 1.9.1, rubygems and rails.
Runninggem install mongrel
worked fine and ostensibly installed mongrel too. I am slightly puzzled because:
- script/server starts webrick by default
which mongrel
returns nothinglocate mongrel
returns lots of entries like/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1 /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/mongrel-1.0.1/lib/mongrel . . . /usr/local/bin/mongrel_rails /usr/local/lib/ruby/gems/1.9.1/cache/mongrel-1.1.5.gem /usr/local/lib/ruby/gems/1.9.1/doc/actionpack-2.3.2/rdoc/files/lib/action_controller/vendor/rack-1_0/rack/handler/evented_mongrel_rb.html /usr/local/lib/ruby/gems/1.9.1/doc/actionpack-2.3.2/rdoc/files/lib/action_controller/vendor/rack-1_0/rack/handler/mongrel_rb.html /usr/local/lib/ruby/gems/1.9.1/doc/actionpack-2.3.2/rdoc/files/lib/action_controller/vendor/rack-1_0/rack/handler/swiftiplied_mongrel_rb.html /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/handler/evented_mongrel.rb /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/handler/mongrel.rb /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/handler/swiftiplied_mongrel.rb /usr/local/lib/ruby/gems/1.9.1/gems/mongrel-1.1.5 . . .Does look like I have mongrel installed (both the default installation and my custom install). So why doesn't which mongrel return something.
Also trying to reinstall mongrel using
gem install mongrel
returns throws its own set of exceptions:Building native extensions. This could take a while... ERROR: Error installing mongrel: ERROR: Failed to build gem native extension. /usr/local/bin/ruby extconf.rb install mongrel checking for main() in -lc... yes creating Makefile make gcc -I. -I/usr/local/include/ruby-1.9.1/i386-darwin9.7.0 -I/usr/local/include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -D_XOPEN_SOURCE=1 -O2 -g -Wall -Wno-parentheses -fno-common -pipe -fno-common -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:77: warning: statement with no effect 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' make: *** [http11.o] Error 1
解决方案It looks like other people are having problems running Mongrel on Ruby 1.9.
The comment by Ami Mahloof seems like it might be a possible fix:
Here’s What you need to do in order to fix it
here’s the updated instructions:
1) cd /usr/local/lib/ruby/gems/1.9.1/gems/mongrel-1.1.5/ext/http11
2) sudo vi / mate on http11.c and:
replace line 77 with
for(ch = RSTRING_PTR(f), end = ch + RSTRING_LEN(f); ch < end; ch++) {
replace line 172 with
colon = strchr(RSTRING_PTR(temp), ':');
replace line 174 with
rb_hash_aset(req, global_server_name, rb_str_substr(temp, 0, colon - RSTRING_PTR(temp)));
replce line 176,177
rb_str_substr(temp, colon - RSTRING_PTR(temp)+1, RSTRING_LEN(temp)));
replace lines 298 299
dptr = RSTRING_PTR(data);
dlen = RSTRING_LEN(data);
3) save the file, close the vi / textmate
4) sudo ruby extconf.rb && sudo make && sudo make install
5) cd ../../lib/mongrel (or the full path "/usr/local/lib/ruby/gems/1.9.1/gems/mongrel-1.1.5/lib/mongrel"
6) mate / sudo vi handlers.rb
7) fix the case statements in
On lines 208-212, change instances of ": false" to "then false"
8) sudo gem install gem_plugin (else mongrel may hang)
done!
这篇关于宝石安装杂种失败与红宝石1.9.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!