Rails, Ubuntu dapper & Mongrel > uninitialized constant Mong

This on Ubuntu testing with the default ruby1.8 package, RubyForge
current
gems, mongrel…this look familiar to anyone??

andre@andre:~/rails_apps/depot$ mongrel_rails
/usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13/lib/mongrel/rails.rb:44:
uninitialized constant Mongrel::HttpHandler (NameError)
from
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:21:in
`require’
from
/usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13/bin/mongrel_rails:5
from /usr/bin/mongrel_rails:18

Thanks,
Andre

On 24/05/06, Andre T. [email protected] wrote:

/usr/lib/ruby/gems/1.8/gems/mongrel-0.3.13/bin/mongrel_rails:5
from /usr/bin/mongrel_rails:18

Looks very familiar, had the same issue this afternoon on a system
that didn’t have a compiler tool chain installed. The error is
because you haven’t compiled the HttpHandler module and thus mongrel
can’t run. Check you have gcc installed and check the installation
process to see that it compiles http11 okay.

Paul.

On Wed, 2006-05-24 at 13:10 -0600, Andre T. wrote:

gcc and friends installed, but http11 didn’t compile properly…kernel
header sources needed for this ?? it just seems kinda strange for a
gem to require this stuff…

I’ll probably take this over to “mongrel-users”, not sure it’s still
appropriate for “rails”…but maybe good for the listmonger to index
for future people with same issue…

I actually use Ubuntu now just so I can suffer through all the crap
people have to put up with from the Debian packaging of Ruby. That’s
right, I suffer so everyone might get some relief.

First off, the pre-release (0.3.13) now checks to see if http11.so
actually built and spits out a nasty error message. This should help
with the silent denial from RubyGems when things fail.

Second, I have to write up the official Mongrel documentation on this
but here’s what got me started:

That whole series is really good, but this will get you a decent base
apache, php, mysql setup going. It’s a little dated but should help a
lot.

Then there’s this older documentation set, with these specific packages:

These instructions install a whole ton of stuff, so you might want to go
through them too. And remember that the stuff is old, so you’ll want to
confirm versions and such.

Then you’ll also want to install packages for readline, irb, ri, and
potentially ruby1.8-dev if that didn’t get installed. (I had to install
it, but other folks don’t). If you get really stuck and desperate then
you can try the shotgun approach:

sudo apt-get install apt-cache search ruby | cut -d ' ' -f 1

But I really don’t suggest this. When all that’s done, then you should
go grab the source to RubyGems, install that manually (don’t use
debian’s since they install to weird locations IIRC).

Additionally, most people don’t even bother with Debian’s packages and
instead compile Ruby from source. I actually do this, but on my Ubuntu
machine I forced myself through the pain so I can write up some
instructions. YMMV.

Once you’ve done all that, I recommend that you complain to the package
maintainers to create a meta-package that allows you to build gems that
have compiled extensions in them.

The irony of the whole problem is if you bring up performance as a
complaint people go off about how you need to learn C and make
extensions and you’re a whiner. If you complain about how difficult it
is to setup Debian with a Ruby capable of building extensions the Debian
folks go off about how you’re an idiot and somehow carving a package
into 200 discrete pieces makes it easier to test (because we all know
that additional complexity makes things easier).

Since this is such a dichotomy with Ruby–and Mongrel is all about
making it easier for folks–I’ll hopefully have some documentation for
Mongrel users on this to match the Win32 documentation, but of course
it’ll be much much longer since even with Ubuntu it’s a royal pain to
get a decent development system going.

Let me know how far you get.


Zed A. Shaw

http://mongrel.rubyforge.org/

gcc and friends installed, but http11 didn’t compile properly…kernel
header sources needed for this ?? it just seems kinda strange for a gem
to
require this stuff…

I’ll probably take this over to “mongrel-users”, not sure it’s still
appropriate for “rails”…but maybe good for the listmonger to index for
future people with same issue…

andre@andre:~$ sudo gem install mongrel
Attempting local installation of ‘mongrel’
Local gem file not found: mongrel*.gem
Attempting remote installation of ‘mongrel’
Select which gem to install for your platform (i486-linux)

  1. mongrel 0.3.12.4 (ruby)
  2. mongrel 0.3.12.4 (mswin32)
  3. mongrel 0.3.12.3 (mswin32)
  4. mongrel 0.3.12.3 (ruby)
  5. mongrel 0.3.12.2 (ruby)
  6. mongrel 0.3.12.2 (mswin32)
  7. mongrel 0.3.12.1 (mswin32)
  8. mongrel 0.3.12.1 (ruby)
  9. mongrel 0.3.12 (mswin32)
  10. mongrel 0.3.12 (ruby)
  11. mongrel 0.3.11 (ruby)
  12. mongrel 0.3.11 (mswin32)
  13. mongrel 0.3.10.1 (ruby)
  14. mongrel 0.3.10 (ruby)
  15. mongrel 0.3.9 (ruby)
  16. mongrel 0.3.8 (ruby)
  17. mongrel 0.3.8 (mswin32)
  18. mongrel 0.3.7.1 (ruby)
  19. mongrel 0.3.7.1 (mswin32)
  20. mongrel 0.3.7 (ruby)
  21. mongrel 0.3.6 (ruby)
  22. mongrel 0.3.6 (mswin32)
  23. mongrel 0.3.5 (ruby)
  24. mongrel 0.3.5 (mswin32)
  25. mongrel 0.3.4 (mswin32)
  26. mongrel 0.3.4 (ruby)
  27. mongrel 0.3.3 (ruby)
  28. mongrel 0.3.2 (ruby)
  29. mongrel 0.3.1 (ruby)
  30. mongrel 0.3 (ruby)
  31. mongrel 0.2.2 (ruby)
  32. mongrel 0.2.1 (ruby)
  33. mongrel 0.2.0 (ruby)
  34. Cancel installation

1
Building native extensions. This could take a while…
In file included from http11.c:1:
/usr/lib/ruby/1.8/i486-linux/ruby.h:28:21: error: stdlib.h: No such file
or
directory
/usr/lib/ruby/1.8/i486-linux/ruby.h:32:21: error: string.h: No such file
or
directory
/usr/lib/ruby/1.8/i486-linux/ruby.h:42:19: error: stdio.h: No such file
or
directory
/usr/lib/ruby/1.8/i486-linux/ruby.h:64:20: error: alloca.h: No such file
or
directory
In file included from
/usr/lib/gcc/i486-linux-gnu/4.0.3/include/syslimits.h:7,
from
/usr/lib/gcc/i486-linux-gnu/4.0.3/include/limits.h:11,
from /usr/lib/ruby/1.8/i486-linux/ruby.h:84,
from http11.c:1:
/usr/lib/gcc/i486-linux-gnu/4.0.3/include/limits.h:122:61: error:
limits.h:
No such file or directory
In file included from /usr/lib/ruby/1.8/i486-linux/ruby.h:677,
from http11.c:1:
/usr/lib/ruby/1.8/i486-linux/missing.h:16:24: error: sys/time.h: No such
file or directory
/usr/lib/ruby/1.8/i486-linux/missing.h:25:25: error: sys/types.h: No
such
file or directory
In file included from /usr/lib/ruby/1.8/i486-linux/ruby.h:678,
from http11.c:1:
/usr/lib/ruby/1.8/i486-linux/intern.h:215: error: syntax error before
‘fd_set’
/usr/lib/ruby/1.8/i486-linux/intern.h:216: warning: ‘struct timeval’
declared inside parameter list
/usr/lib/ruby/1.8/i486-linux/intern.h:216: warning: its scope is only
this
definition or declaration, which is probably not what you want
/usr/lib/ruby/1.8/i486-linux/intern.h:446: warning: parameter names
(without
types) in function declaration
In file included from http11.c:1:
/usr/lib/ruby/1.8/i486-linux/ruby.h:687:21: error: pthread.h: No such
file
or directory
In file included from http11.c:1:
/usr/lib/ruby/1.8/i486-linux/ruby.h:689: error: syntax error before
‘rb_nativethread_t’
/usr/lib/ruby/1.8/i486-linux/ruby.h:689: warning: type defaults to ‘int’
in
declaration of ‘rb_nativethread_t’
/usr/lib/ruby/1.8/i486-linux/ruby.h:689: warning: data definition has no
type or storage class
http11.c:3:20: error: assert.h: No such file or directory
http11.c:6:19: error: ctype.h: No such file or directory
http11.c: In function ‘http_field’:
http11.c:72: warning: implicit declaration of function ‘toupper’
http11.c: In function ‘header_done’:
http11.c:144: warning: implicit declaration of function ‘strchr’
http11.c:144: warning: incompatible implicit declaration of built-in
function ‘strchr’
http11.c:126: warning: unused variable ‘port’
http11.c:125: warning: unused variable ‘host’
http11.c: In function ‘HttpParser_free’:
http11.c:165: warning: implicit declaration of function ‘free’
http11.c: In function ‘URIClassifier_alloc’:
http11.c:333: warning: implicit declaration of function ‘assert’
make: *** [http11.o] Error 1
In file included from http11.c:1:
/usr/lib/ruby/1.8/i486-linux/ruby.h:28:21: error: stdlib.h: No such file
or
directory
/usr/lib/ruby/1.8/i486-linux/ruby.h:32:21: error: string.h: No such file
or
directory
/usr/lib/ruby/1.8/i486-linux/ruby.h:42:19: error: stdio.h: No such file
or
directory
/usr/lib/ruby/1.8/i486-linux/ruby.h:64:20: error: alloca.h: No such file
or
directory
In file included from
/usr/lib/gcc/i486-linux-gnu/4.0.3/include/syslimits.h:7,
from
/usr/lib/gcc/i486-linux-gnu/4.0.3/include/limits.h:11,
from /usr/lib/ruby/1.8/i486-linux/ruby.h:84,
from http11.c:1:
/usr/lib/gcc/i486-linux-gnu/4.0.3/include/limits.h:122:61: error:
limits.h:
No such file or directory
In file included from /usr/lib/ruby/1.8/i486-linux/ruby.h:677,
from http11.c:1:
/usr/lib/ruby/1.8/i486-linux/missing.h:16:24: error: sys/time.h: No such
file or directory
/usr/lib/ruby/1.8/i486-linux/missing.h:25:25: error: sys/types.h: No
such
file or directory
In file included from /usr/lib/ruby/1.8/i486-linux/ruby.h:678,
from http11.c:1:
/usr/lib/ruby/1.8/i486-linux/intern.h:215: error: syntax error before
‘fd_set’
/usr/lib/ruby/1.8/i486-linux/intern.h:216: warning: ‘struct timeval’
declared inside parameter list
/usr/lib/ruby/1.8/i486-linux/intern.h:216: warning: its scope is only
this
definition or declaration, which is probably not what you want
/usr/lib/ruby/1.8/i486-linux/intern.h:446: warning: parameter names
(without
types) in function declaration
In file included from http11.c:1:
/usr/lib/ruby/1.8/i486-linux/ruby.h:687:21: error: pthread.h: No such
file
or directory
In file included from http11.c:1:
/usr/lib/ruby/1.8/i486-linux/ruby.h:689: error: syntax error before
‘rb_nativethread_t’
/usr/lib/ruby/1.8/i486-linux/ruby.h:689: warning: type defaults to ‘int’
in
declaration of ‘rb_nativethread_t’
/usr/lib/ruby/1.8/i486-linux/ruby.h:689: warning: data definition has no
type or storage class
http11.c:3:20: error: assert.h: No such file or directory
http11.c:6:19: error: ctype.h: No such file or directory
http11.c: In function ‘http_field’:
http11.c:72: warning: implicit declaration of function ‘toupper’
http11.c: In function ‘header_done’:
http11.c:144: warning: implicit declaration of function ‘strchr’
http11.c:144: warning: incompatible implicit declaration of built-in
function ‘strchr’
http11.c:126: warning: unused variable ‘port’
http11.c:125: warning: unused variable ‘host’
http11.c: In function ‘HttpParser_free’:
http11.c:165: warning: implicit declaration of function ‘free’
http11.c: In function ‘URIClassifier_alloc’:
http11.c:333: warning: implicit declaration of function ‘assert’
make: *** [http11.o] Error 1
ruby extconf.rb install mongrel
checking for main() in -lc… no
creating Makefile

make
gcc -fPIC -Wall -g -O2 -fPIC -I. -I/usr/lib/ruby/1.8/i486-linux
-I/usr/lib/ruby/1.8/i486-linux -I. -c http11.c

make install
gcc -fPIC -Wall -g -O2 -fPIC -I. -I/usr/lib/ruby/1.8/i486-linux
-I/usr/lib/ruby/1.8/i486-linux -I. -c http11.c
Successfully installed mongrel-0.3.12.4
Installing RDoc documentation for mongrel-0.3.12.4…
andre@andre:~$

Thanks Z for the info, I’ll fight with it until I finish it or it
finishes
me, then I’ll post back.

-Andre

On 5/24/06, Zed S. [email protected] wrote:

These instructions install a whole ton of stuff, so you might want to go
But I really don’t suggest this. When all that’s done, then you should
have compiled extensions in them.
making it easier for folks–I’ll hopefully have some documentation for


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

andre turpin

em: [email protected]
ph: 867-874-5819

On Wed, 2006-05-24 at 16:01 -0400, Zed S. wrote:

Additionally, most people don’t even bother with Debian’s packages and
instead compile Ruby from source. I actually do this, but on my Ubuntu
machine I forced myself through the pain so I can write up some
instructions. YMMV.

If you choose to install Ruby from source, but still want it Debian
packaged (for easy removal or updating in the future, and all of those
other great things that apt/dpkg provides), you can use checkinstall to
create a package. It’s pretty easy to use.

Just sudo apt-get install checkinstall, then, instead of doing ‘make
install’ as the last step of installing via the make chain, just type
‘checkinstall’ instead.

So:
./configure
make
checkinstall

– AL –

On Fri, 2006-06-02 at 14:10 -0400, Alison Rowland wrote:

I’m currently running Litespeed, proxying to Mongrel. I had some
issues with Mongrel_Cluster which were probably related to Ubuntu’s
ruby packaging, but I figured out a solution and have written it up at
[2].

Very nice Alison. Glad you got over the nasty debian hump. It still
baffles me why that platform is so difficult for Ruby.


Zed A. Shaw

http://mongrel.rubyforge.org/

Looks very familiar, had the same issue this afternoon on a system
that didn’t have a compiler tool chain installed. The error is
because you haven’t compiled the HttpHandler module and thus mongrel
can’t run. Check you have gcc installed and check the installation
process to see that it compiles http11 okay.

** Also check if you have ‘make’ installed **.

I had a similar problem - installed ubuntu 6.06 x86_64 yesterday and
mongrel
rails complained about uninitialized constant. I had gcc already
installed,
but was surprised to discover that ubuntu does not install GNU make by
default! Ubuntu is indeed an user- not nerd-oriented system ;-)!

After the installation of ‘make’ with synaptic, I had to uninstall
mongrel

sudo gem uninstall mongrel

and install it again:

sudo gem install mongrel.

Now mongrel_rails starts as it should.

Yuri Baranov baranovu_AT_gmail_DOT_com

View this message in context:
http://www.nabble.com/Rails%2C-Ubuntu-dapper---Mongrel->-uninitialized-constant-Mongrel%3A%3AHttpHandler-error-tf1674833.html#a5081123
Sent from the RubyOnRails Users forum at Nabble.com.

FWIW, I used Ezra Z.’ instructions [1] for setting up a
deployment server, using Ubuntu instead of Debian, and things are
going just fine. I upgraded to Dapper before it was released, so I
could get ruby 1.8.4 instead of Breezy’s 1.8.3.

Perhaps there’s something in Ezra’s directions that will be helpful.

I’m currently running Litespeed, proxying to Mongrel. I had some
issues with Mongrel_Cluster which were probably related to Ubuntu’s
ruby packaging, but I figured out a solution and have written it up at
[2].

[1]
http://brainspl.at/articles/2005/11/13/the-perfect-lightweight-rails-lighttpd-debian-install
[2]
http://blog.alisonrowland.com/articles/2006/06/01/mongrel_cluster_ctl-at-startup-on-ubuntu-6-06

Good luck.

–Alison