I can't install Rails. I followed this tutorial from RyanBigg, and downloaded a lot of dev tools. ruby-dev and build essential are installed and up to date.
This is basically the answer i found on stackoverflow : install development tools. It looks like a classic problem, but no classic solution seems to fix it.
This question and this other one are related to the exact same problem, and no one leads to a solution.
I'm currently moving my work from Archlinux to Ubuntu 12.04. I'm learning web developement with Ruby 2.0.0 and Rails 4.0. I'm using rvm 1.25.15.
  gem install rails -v 4.0.2
  Building native extensions.  This could take a while...
  ERROR:  Error installing rails:
  ERROR: Failed to build gem native extension.
  /home/remy/.rvm/rubies/ruby-2.0.0-p353/bin/ruby extconf.rb
  *** extconf.rb failed ***
  Could not create Makefile due to some reason, probably lack of necessary
  libraries and/or headers.  Check the mkmf.log file for more details.  
  You may need configuration options.
        Provided configuration options:
            --with-opt-dir
            --without-opt-dir
            --with-opt-include
            --without-opt-include=${opt-dir}/include
            --with-opt-lib
            --without-opt-lib=${opt-dir}/lib
            --with-make-prog
            --without-make-prog
            --srcdir=.
            --curdir
            --ruby=/home/remy/.rvm/rubies/ruby-2.0.0-p353/bin/ruby
            --with-atomic_reference-dir
            --without-atomic_reference-dir
            --with-atomic_reference-include
            --without-atomic_reference-include=${atomic_reference-dir}/include
            --with-atomic_reference-lib
            --without-atomic_reference-lib=${atomic_reference-dir}/
        /home/remy/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:434:in `try_do':
  The compiler failed to generate an executable file. (RuntimeError)
  You have to install development tools first.
  from /home/remy/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:519:in`try_link0'
  from /home/remy/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:817:in `try_run'
  from extconf.rb:26:in `<main>'
  extconf failed, exit code 1
  Gem files will remain installed in 
  /home/remy/.rvm/gems/ruby-2.0.0-p353@global/gems/atomic-1.1.14 for inspection.
  Results logged to 
  /home/remy/.rvm/gems/ruby-2.0.0-p353@global/extensions/x86_64-linux/2.0.0
  /atomic-1.1.14/gem_make.out
The solution proposed by mhartl here (basically: use rubygem 2.0.3) don't work better.
This is the output of gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 2.2.1
  - RUBY VERSION: 2.0.0 (2013-11-22 patchlevel 353) [x86_64-linux]
  - INSTALLATION DIRECTORY: /home/remy/.rvm/gems/ruby-2.0.0-p353@global
  - RUBY EXECUTABLE: /home/remy/.rvm/rubies/ruby-2.0.0-p353/bin/ruby
  - EXECUTABLE DIRECTORY: /home/remy/.rvm/gems/ruby-2.0.0-p353@global/bin
  - SPEC CACHE DIRECTORY: /home/remy/.gem/specs
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /home/remy/.rvm/gems/ruby-2.0.0-p353@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /home/remy/.rvm/gems/ruby-2.0.0-p353@global/bin
     - /home/remy/.rvm/rubies/ruby-2.0.0-p353/bin
     - /home/remy/.rvm/bin
     - /usr/lib/lightdm/lightdm
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin
     - /usr/games
And this comes after rvm info
ruby-2.0.0-p353:
  system:
    uname:       "Linux Ruff 3.8.0-35-generic #50~precise1-Ubuntu SMP Wed Dec 4 17:25:51 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux"
    system:      "ubuntu/12.04/x86_64"
    bash:        "/bin/bash => GNU bash, version 4.2.25(1)-release (x86_64-pc-linux-gnu)"
    zsh:         " => not installed"
  rvm:
    version:      "rvm 1.25.15 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
    updated:      "1 hour 54 minutes 23 seconds ago"
    path:         "/home/remy/.rvm"
  ruby:
    interpreter:  "ruby"
    version:      "2.0.0p353"
    date:         "2013-11-22"
    platform:     "x86_64-linux"
    patchlevel:   "2013-11-22 revision 43784"
    full_version: "ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-linux]"
  homes:
    gem:          "/home/remy/.rvm/gems/ruby-2.0.0-p353"
    ruby:         "/home/remy/.rvm/rubies/ruby-2.0.0-p353"
  binaries:
    ruby:         "/home/remy/.rvm/rubies/ruby-2.0.0-p353/bin/ruby"
    irb:          "/home/remy/.rvm/rubies/ruby-2.0.0-p353/bin/irb"
    gem:          "/home/remy/.rvm/rubies/ruby-2.0.0-p353/bin/gem"
    rake:         "/home/remy/.rvm/gems/ruby-2.0.0-p353@global/bin/rake"
  environment:
    PATH:         "/home/remy/.rvm/gems/ruby-2.0.0-p353/bin:/home/remy/.rvm/gems/ruby-2.0.0-p353@global/bin:/home/remy/.rvm/rubies/ruby-2.0.0-p353/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/remy/.rvm/bin"
    GEM_HOME:     "/home/remy/.rvm/gems/ruby-2.0.0-p353"
    GEM_PATH:     "/home/remy/.rvm/gems/ruby-2.0.0-p353:/home/remy/.rvm/gems/ruby-2.0.0-p353@global"
    MY_RUBY_HOME: "/home/remy/.rvm/rubies/ruby-2.0.0-p353"
    IRBRC:        "/home/remy/.rvm/rubies/ruby-2.0.0-p353/.irbrc"
    RUBYOPT:      ""
    gemset:       ""
I found interesting the result of locate mkmf, but what i found there is clearly out of my range technicaly.
locate mkmf
/home/remy/.rvm/gems/ruby-2.0.0-p353/gems/atomic-1.1.14/ext/mkmf.log
/home/remy/.rvm/gems/ruby-2.0.0-p353@global/gems/bigdecimal-1.2.5/mkmf.log
/home/remy/.rvm/gems/ruby-2.0.0-p353@global/gems/psych-2.0.2/ext/psych/mkmf.log
/home/remy/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb
/usr/lib/ruby/1.8/mkmf.rb
/var/lib/gems/1.8/gems/atomic-1.1.14/ext/mkmf.log
I tryed the installation process of this RailsApp tutorial. Under the section "RVM’s Global Gemset", using the initial global gemset, the gem update command return 3 errors : bigdecimal, json and psych. First and last errors messages are quite the same, but the json one is much more interesting. Or seems like, I don't really get it.
1 bigdecimal
    Updating bigdecimal
    Fetching: bigdecimal-1.2.5.gem (100%)
    ERROR:  Error installing bigdecimal:
    ERROR: Failed to build gem native extension.
    /home/remy/.rvm/rubies/ruby-2.0.0-p353/bin/ruby extconf.rb
    checking for labs() in stdlib.h... 
    *** extconf.rb failed ***
    Could not create Makefile due to some reason, probably lack of necessary
    libraries and/or headers.  Check the mkmf.log file for more details.  You may
    need configuration options.
    Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/home/remy/.rvm/rubies/ruby-2.0.0-p353/bin/ruby
    /home/remy/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
        from /home/remy/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:519:in `try_link0'
        from /home/remy/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:534:in `try_link'
        from /home/remy/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:720:in `try_func'
        from /home/remy/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:1004:in `block in have_func'
        from /home/remy/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:895:in `block in checking_for'
        from /home/remy/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:340:in `block (2 levels) in postpone'
        from /home/remy/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:310:in `open'
        from /home/remy/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:340:in `block in postpone'
        from /home/remy/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:310:in `open'
        from /home/remy/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:336:in `postpone'
        from /home/remy/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:894:in `checking_for'
        from /home/remy/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:1003:in `have_func'
        from extconf.rb:3:in `<main>'
    extconf failed, exit code 1
    Gem files will remain installed in /home/remy/.rvm/gems/ruby-2.0.0-p353@global/gems/bigdecimal-1.2.5 for inspection.
    Results logged to /home/remy/.rvm/gems/ruby-2.0.0-p353@global/extensions/x86_64-linux/2.0.0/bigdecimal-1.2.5/gem_make.out
2 Json
Updating json
Fetching: json-1.8.1.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing json:
ERROR: Failed to build gem native extension.
/home/remy/.rvm/rubies/ruby-2.0.0-p353/bin/ruby extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling generator.c
make: I. : commande introuvable
make: [generator.o] Erreur 127 (ignorée)
linking shared-object json/ext/generator.so
make: shared : commande introuvable
make: [generator.so] Erreur 127 (ignorée)
make "DESTDIR=" install
compiling generator.c
make: I. : commande introuvable
make: [generator.o] Erreur 127 (ignorée)
linking shared-object json/ext/generator.so
make: shared : commande introuvable
make: [generator.so] Erreur 127 (ignorée)
/usr/bin/install -m 0755 generator.so ./.gem.20140129-22923-temaos/json/ext
/usr/bin/install: impossible d'évaluer «generator.so»: Aucun fichier ou dossier de ce type
make: *** [install-so] Erreur 1
make install failed, exit code 2
Gem files will remain installed in /home/remy/.rvm/gems/ruby-2.0.0-p353@global/gems/json-1.8.1 for inspection.
Results logged to /home/remy/.rvm/gems/ruby-2.0.0-p353@global/extensions/x86_64-linux/2.0.0/json-1.8.1/gem_make.out
3 Psych
Updating psych
Fetching: psych-2.0.2.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing psych:
ERROR: Failed to build gem native extension.
/home/remy/.rvm/rubies/ruby-2.0.0-p353/bin/ruby extconf.rb
checking for yaml.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.
Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/home/remy/.rvm/rubies/ruby-2.0.0-p353/bin/ruby
    --with-libyaml-dir
    --without-libyaml-dir
    --with-libyaml-include
    --without-libyaml-include=${libyaml-dir}/include
    --with-libyaml-lib
    --without-libyaml-lib=${libyaml-dir}/
    --enable-bundled-libyaml
    --disable-bundled-libyaml
/home/remy/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /home/remy/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:565:in `try_cpp'
    from /home/remy/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:1097:in `block in find_header'
    from /home/remy/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:895:in `block in checking_for'
    from /home/remy/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:340:in `block (2 levels) in postpone'
    from /home/remy/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:310:in `open'
    from /home/remy/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:340:in `block in postpone'
    from /home/remy/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:310:in `open'
    from /home/remy/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:336:in `postpone'
    from /home/remy/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:894:in `checking_for'
    from /home/remy/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:1096:in `find_header'
    from extconf.rb:9:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /home/remy/.rvm/gems/ruby-2.0.0-p353@global/gems/psych-2.0.2 for inspection.
Results logged to /home/remy/.rvm/gems/ruby-2.0.0-p353@global/extensions/x86_64-linux/2.0.0/psych-2.0.2/gem_make.out
 
    