7

I'm installing rails on Ubuntu machine, so far I got no problems reading the following tutorials:

https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-ubuntu-12-04-lts-precise-pangolin-with-rvm http://pragashblog.blogspot.com/2012/05/setting-up-rvm-ruby-and-rails-on-ubuntu.html

However when I try to install rails:

gem install rails

I'm getting the following error:

Building native extensions.  This could take a while...
ERROR:  Error installing rails:
ERROR: Failed to build gem native extension.

    /usr/local/rvm/rubies/ruby-1.9.3-p374/bin/ruby extconf.rb
creating Makefile

make
compiling generator.c
make: I.: Command not found
make: [generator.o] Error 127 (ignored)
linking shared-object json/ext/generator.so
make: shared: Command not found
make: [generator.so] Error 127 (ignored)

make install
compiling generator.c
make: I.: Command not found
make: [generator.o] Error 127 (ignored)
linking shared-object json/ext/generator.so
make: shared: Command not found
make: [generator.so] Error 127 (ignored)
 /usr/bin/install -c -m 0755 generator.so /usr/local/rvm/gems/ruby-1.9.3-p374/gems/json-    1.7.6/lib/json/ext
/usr/bin/install: cannot stat `generator.so': No such file or directory
make: *** [/usr/local/rvm/gems/ruby-1.9.3-p374/gems/json-1.7.6/lib/json/ext/generator.so] Error 1


Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p374/gems/json-1.7.6 for inspection.
 Results logged to /usr/local/rvm/gems/ruby-1.9.3-p374/gems/json-1.7.6/ext/json/ext/generator/gem_make.out

Obviously I already checked that make is available, and that it is on the PATH. In fact, which make and which which rvm give the following results: /usr/bin/make /usr/local/rvm/bin/rvm

So... I don't think it's related to PATH.

Any Ideas?? What should I do?

Pablo
  • 3,433
  • 7
  • 44
  • 62
  • Make is not finding `generator.so` because it's not being compiled; `make: [generator.so] Error 127 (ignored)`. The key errors are `make: I.: Command not found` and `make: shared: Command not found`. Are you using the standard GCC from the repository? Also make sure your build essentials are up to date with `apt-get install build-essentials`. – dward Jan 31 '13 at 21:27
  • Ok, so I checked installing build-essential package... however got the same error. – Pablo Jan 31 '13 at 21:32
  • Just to be absolutly sure, check that you have all the other required packages: `apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config` and make sure there are no errors. It does seem like you are missing some header somewhere though. – dward Jan 31 '13 at 21:35
  • Yes, they are all up to date – Pablo Jan 31 '13 at 21:38
  • Sorry, I'm beat. not sure what it could be. One last ditch effort, try reinstalling the rvm packages with `rvm get head && rvm pkg remove && rvm requirements run && rvm reinstall 1.9.3`. Then you might have to start messing with the compiler flags. Good luck! – dward Jan 31 '13 at 21:50

2 Answers2

7

you are missing required packages:

rvm get head
rvm requirements run
rvm remove 1.9.3
rvm use 1.9.3 --install --default
gem install rails
mpapis
  • 52,729
  • 14
  • 121
  • 158
  • I'm sure I have all the requirements, I did those exactly steps but no luck at all, anyway I don't think I need rails in this case... my goal is just to deploy a rails app and I think it's enough with bundler right? – Pablo Feb 01 '13 at 15:08
  • Think this problem was related to permissions after all, I didn't install rails directly using the gem install command. But Bundler did... anyway I got lots of trouble to deploy my app until I started using rvmsudo before all my commands. – Pablo Feb 01 '13 at 17:46
5

I had the same issue...running 'rvm reinstall 1.9.3' after 'sudo apt-get install build-essentials' fixed it for me. I guess maybe ruby didn't notice when I installed gcc, and still believed I didn't have it.

jediry
  • 51
  • 2