I am deploying Ruby On Rails apps on an Amazon EC2 cloud server. The server is running on Amazon Linux alami-2011.02. I can't say the distro it's based on (from my search, RedHat/CentOS, but I'm newbie in that field).

I've installed my Ruby environment with RVM (installed as root). I've setup two rubies:

* REE 1.8.7
* Ruby 1.9.2-p290

For each Rails app I deploy, I create a separate RVM gemset.

Since I ran in this problem, I've refreshed completely the Ruby environment by running `rvm implode`.

Here are my environment versions:

```
ruby -v      ---> ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
rvm -v       ---> 1.8.1
gem -v       ---> 1.6.2
bundle -v    ---> Bundler version 1.0.18

```

After this `rvm implode`:

* I installed again the 2 rubies
* I created a gemset for a ree-1.8.7 app and installed the gems required -> no problem
* I created a gemset for a ruby-1.9.2 app and installed the gems through Bundle -> **no problem, even for the gems with native extensions**
* I created a gemset for another ruby-1.9.2, tried to install the gems through Bundle... **here it comes again!**

This is what I get know when performing `bundle install` (logged in as root):

```
Updating https://github.com/p7r/will_paginate.git
Fetching source index for http://rubygems.org/
Installing rake (0.9.2) 
Installing multi_json (1.0.3) 
Installing activesupport (3.1.0) 
Installing bcrypt-ruby (3.0.0) with native extensions /usr/local/rvm/scripts/rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:552:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

        /usr/local/rvm/scripts/rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb 

Gem files will remain installed in /usr/local/rvm/scripts/rvm/gems/ruby-1.9.2-p290@app/gems/bcrypt-ruby-3.0.0 for inspection.
Results logged to /usr/local/rvm/scripts/rvm/gems/ruby-1.9.2-p290@app/gems/bcrypt-ruby-3.0.0/ext/mri/gem_make.out

    [ removed the backtrace ]

```

However, if i just use `gem install bcrypt`, the gem install correctly, and I can just use `bundle install` which will run until the next gem with native extensions...

I've had the same issue with a ruby-1.9.2-p180 install, I tried downgrading RubyGems to different versions until 1.5.3, I imploded my RVM... I've looked a lot on the web for answers, this problem seems recurrent, but nothing worked for me.

Thanks in advance for your help!