What. A. Pain.
UPDATE: I'm now using thin instead of mongrel.
When you go to do
This stuff was worked out by Alan and clarified by Ami Mahloof
UPDATE: I'm now using thin instead of mongrel.
When you go to do
sudo gem install mongrel
it will barf with some errors related to a file called http1.c Stop. Do not adjust the channel. There is nothing wrong with your computer. Somebody goofed in the source code. From instructions here, you have to make the following changes to the source. Remember to edit as root, don't run gem install mongrel again - you will overwrite your corrections.This stuff was worked out by Alan and clarified by 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 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)Full error message:
local:Rriki2 kghose$ sudo gem install mongrel 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.6.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 Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/mongrel-1.1.5 for inspection. Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/mongrel-1.1.5/ext/http11/gem_make.out
Has this been fixed upstream yet? I'm running a fully updated Snow Leopard machine (as of today) and am still getting this error, so I would guess not.. :(
ReplyDeleteMacPorts 1.9.1
OSX 10.6.4
ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-darwin10]
If you can, switch to thin. I've not looked back. But I only use my Rails app on my local computer as a single user.
ReplyDeleteJust in case someone runs across this old post top of the google search like I did.... Installing with --pre option seems to work and is much easier.
ReplyDeletesudo gem install mongrel --pre
thanks, that worked.
ReplyDelete