gem install mongrel fails with ruby 1.9.1

牧云@^-^@ 提交于 2019-12-03 01:23:34
Olly

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!

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

$ sudo gem1.9 install mongrel --pre
> Building native extensions.  This could take a while...
> Successfully installed mongrel-1.2.0.pre2
> 1 gem installed

It is a compilation issue so it’s easier to do this:

git clone git://github.com/mongrel/mongrel.git

cd mongrel/ext/http/

Now edit the http11.c:

#ifndef RSTRING_PTR
#define RSTRING_PTR(s) (RSTRING(s))
#endif
#ifndef RSTRING_LEN
#define RSTRING_LEN(s) (RSTRING(s))
#endif

Save it and now from the same directory do the following:

sudo ruby extconf.rb && sudo make && sudo make install

Done!

You Can Force To Install mongrel like this

sudo gem install mongrel -v 1.2.0.pre2 -- --with-cflags=\"-O2 -pipe -march=native -w\"

This Solve the issue.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!