I had this problem when installing Mongrel on ubuntu hardy heron in my laptop.
When I type,
{code type=ruby}
gem install mongrel
{/code}
This message appears:
{code type=ruby}
ERROR: Error installing mongrel:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb install mongrel
creating Makefile
make
cc -I. -I/usr/lib/ruby/1.8/i486-linux -I/usr/lib/ruby/1.8/i486-linux -I. -fPIC -fno-strict-aliasing -g -g -O2 -fPIC -c fastthread.c
In file included from fastthread.c:12:
/usr/lib/ruby/1.8/i486-linux/ruby.h:40:21: error: stdlib.h: No such file or directory
/usr/lib/ruby/1.8/i486-linux/ruby.h:44:21: error: string.h: No such file or directory
/usr/lib/ruby/1.8/i486-linux/ruby.h:54:19: error: stdio.h: No such file or directory
/usr/lib/ruby/1.8/i486-linux/ruby.h:71:20: error: alloca.h: No such file or directory
In file included from /usr/lib/gcc/i486-linux-gnu/4.2.3/include/syslimits.h:7,
from /usr/lib/gcc/i486-linux-gnu/4.2.3/include/limits.h:11,
from /usr/lib/ruby/1.8/i486-linux/ruby.h:91,
from fastthread.c:12:
/usr/lib/gcc/i486-linux-gnu/4.2.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:718,
from fastthread.c:12:
/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:719,
from fastthread.c:12:
/usr/lib/ruby/1.8/i486-linux/intern.h:219: error: expected declaration specifiers or ‘…’ before ‘fd_set’
/usr/lib/ruby/1.8/i486-linux/intern.h:219: error: expected declaration specifiers or ‘…’ before ‘fd_set’
/usr/lib/ruby/1.8/i486-linux/intern.h:219: error: expected declaration specifiers or ‘…’ before ‘fd_set’
/usr/lib/ruby/1.8/i486-linux/intern.h:219: warning: ‘struct timeval’ declared inside parameter list
/usr/lib/ruby/1.8/i486-linux/intern.h:219: 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:220: warning: ‘struct timeval’ declared inside parameter list
/usr/lib/ruby/1.8/i486-linux/intern.h:454: warning: parameter names (without types) in function declaration
In file included from fastthread.c:12:
/usr/lib/ruby/1.8/i486-linux/ruby.h:728:21: error: pthread.h: No such file or directory
In file included from fastthread.c:12:
/usr/lib/ruby/1.8/i486-linux/ruby.h:730: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rb_nativethread_t’
In file included from fastthread.c:13:
/usr/lib/ruby/1.8/i486-linux/intern.h:219: error: expected declaration specifiers or ‘…’ before ‘fd_set’
/usr/lib/ruby/1.8/i486-linux/intern.h:219: error: expected declaration specifiers or ‘…’ before ‘fd_set’
/usr/lib/ruby/1.8/i486-linux/intern.h:219: error: expected declaration specifiers or ‘…’ before ‘fd_set’
/usr/lib/ruby/1.8/i486-linux/intern.h:219: warning: ‘struct timeval’ declared inside parameter list
/usr/lib/ruby/1.8/i486-linux/intern.h:219: error: conflicting types for ‘rb_thread_select’
/usr/lib/ruby/1.8/i486-linux/intern.h:219: error: previous declaration of ‘rb_thread_select’ was here
/usr/lib/ruby/1.8/i486-linux/intern.h:220: warning: ‘struct timeval’ declared inside parameter list
/usr/lib/ruby/1.8/i486-linux/intern.h:220: error: conflicting types for ‘rb_thread_wait_for’
/usr/lib/ruby/1.8/i486-linux/intern.h:220: error: previous declaration of ‘rb_thread_wait_for’ was here
/usr/lib/ruby/1.8/i486-linux/intern.h:454: warning: parameter names (without types) in function declaration
In file included from fastthread.c:14:
/usr/lib/ruby/1.8/i486-linux/rubysig.h:15:19: error: errno.h: No such file or directory
fastthread.c: In function ‘wait_condvar’:
fastthread.c:626: warning: passing argument 1 of ‘rb_ensure’ from incompatible pointer type
make: *** [fastthread.o] Error 1
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/fastthread-1.0.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/fastthread-1.0.1/ext/fastthread/gem_make.out
{/code}
You only need to type this in terminal:
{code type=ruby}
apt-get install build-essential
{/code}
Update:
With the code from above, I was able to install passenger (mod_rails). I was asked to configure apache to load Passenger using “LoadModule”, and add a virtualhost to my rails app.
If ever you see upon clicking your app’s environment link, saying “Routing Error: no route matches … ” test your rails app by running webrick and try re-clicking that link again. If you still see that error, the chances are you misconfigured rails. If not, then you’re good to go! It is said that modifying your app environment to production mode will repair that problem. I put RailsEnv production inside the virtualHost configuration just in case.
It is said that that link is buggy and deprecated already (link). If you managed to repair the problem, please let me know by posting it as a comment. Thanks!
Tags: Mongrel, Ruby on Rails
