json ERROR: Failed to build gem native extension

I am quite new to rails and try now to set up a deployment environment. However I do not have the experience to over come every obstacle:

Centos 5.4 x86_64 apache 2.2.3 rvm 1.6.13 ruby 1.9.2-p0 passenger 3.0.7 capistrano 2.5.21

I have installed rvm as root. ruby 1.9.2-p0 installed and set as default. Installed passenger and adapted the apache config. Deployed the rails app with capistrano.

Then I pont the browser to https://localhost.localdomain/reg

The browser shows a passenger error: Ruby on Rails application could not be started Could not find json-1.5.1 in any of the sources (Bundler::GemNotFound) Backtrace: Frame 0: /usr/local/rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.13/lib/bundler/ spec_set.rb Frame 9: /usr/local/rvm/gems/ruby-1.9.2-p0/gems/passenger-3.0.7/lib/ phusion_passenger/utils.rb

when i go to the rails app and run bundle install it fails while building json: Installing json (1.5.1) with native extensions /usr/local/rvm/rubies/ ruby-1.9.2-p0/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:533:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

but $ gem install json installs 1.5.1 without a probelm

I do all this as root. It seems to me that there is a mix up of environments but do not know how to fix it. The error messge mentions / usr/local/rvm/rubies/ruby-1.9.2-p0/lib/ruby/site_ruby/1.9.1/rubygems/ installer.rb Why 191 and not 1.9.2 ?

xp:/var/www/html/registration/current# gem env /usr/local/rvm/rubies/ruby-1.9.2-p0/bin/gem:4: warning: Insecure world writable dir /var/www/html in PATH, mode 040777 RubyGems Environment:   - RUBYGEMS VERSION: 1.6.2   - RUBY VERSION: 1.9.2 (2010-08-18 patchlevel 0) [x86_64-linux]   - INSTALLATION DIRECTORY: /usr/local/rvm/gems/ruby-1.9.2-p0   - RUBY EXECUTABLE: /usr/local/rvm/rubies/ruby-1.9.2-p0/bin/ruby   - EXECUTABLE DIRECTORY: /usr/local/rvm/gems/ruby-1.9.2-p0/bin   - RUBYGEMS PLATFORMS:     - ruby     - x86_64-linux   - GEM PATHS:      - /usr/local/rvm/gems/ruby-1.9.2-p0      - /usr/local/rvm/gems/ruby-1.9.2-p0@global   - GEM CONFIGURATION:      - :update_sources => true      - :verbose => true      - :benchmark => false      - :backtrace => false      - :bulk_threshold => 1000   - REMOTE SOURCES:      - http://rubygems.org/

Generally how does one dignose the cause for Failed to build gem native extension, I was not able to find a log file to find out what went wrong.

Thank you Ernst

I am quite new to rails and try now to set up a deployment

environment. However I do not have the experience to over come every

obstacle:

Centos 5.4 x86_64

apache 2.2.3

rvm 1.6.13

ruby 1.9.2-p0

passenger 3.0.7

capistrano 2.5.21

I have installed rvm as root. ruby 1.9.2-p0 installed and set as

default.

Installed passenger and adapted the apache config. Deployed the rails

app

with capistrano.

Then I pont the browser to https://localhost.localdomain/reg

The browser shows a passenger error:

Ruby on Rails application could not be started

Could not find json-1.5.1 in any of the sources (Bundler::GemNotFound)

Backtrace:

Frame 0:

/usr/local/rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.13/lib/bundler/

spec_set.rb

Frame 9:

/usr/local/rvm/gems/ruby-1.9.2-p0/gems/passenger-3.0.7/lib/

phusion_passenger/utils.rb

when i go to the rails app and run

bundle install

it fails while building json:

Installing json (1.5.1) with native extensions /usr/local/rvm/rubies/

ruby-1.9.2-p0/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:533:in

`rescue in block in build_extensions’: ERROR: Failed to build gem

native extension. (Gem::Installer::ExtensionBuildError)

but $ gem install json

installs 1.5.1 without a probelm

After you do this and you then run ‘bundle install’ do you still get the error?

Also, are you using a gemset with rvm? And just to be sure have you confirmed your rvm settings with ‘rvm current’?

I do all this as root. It seems to me that there is a mix up of

environments but do not know how to fix it. The error messge mentions /

usr/local/rvm/rubies/ruby-1.9.2-p0/lib/ruby/site_ruby/1.9.1/rubygems/

installer.rb Why 191 and not 1.9.2 ?

I wondered about this in the past and dont know the answer but this as it should be.

> I am quite new to rails and try now to set up a deployment > environment. However I do not have the experience to over come every > obstacle:

> Centos 5.4 x86_64 > apache 2.2.3 > rvm 1.6.13 > ruby 1.9.2-p0 > passenger 3.0.7 > capistrano 2.5.21

> I have installed rvm as root. ruby 1.9.2-p0 installed and set as > default. > Installed passenger and adapted the apache config. Deployed the rails > app > with capistrano.

> Then I pont the browser tohttps://localhost.localdomain/reg

> The browser shows a passenger error: > Ruby on Rails application could not be started > Could not find json-1.5.1 in any of the sources (Bundler::GemNotFound) > Backtrace: > Frame 0: > /usr/local/rvm/gems/ruby-1.9.2-p0/gems/bundler-1.0.13/lib/bundler/ > spec_set.rb > Frame 9: > /usr/local/rvm/gems/ruby-1.9.2-p0/gems/passenger-3.0.7/lib/ > phusion_passenger/utils.rb

> when i go to the rails app and run > bundle install > it fails while building json: > Installing json (1.5.1) with native extensions /usr/local/rvm/rubies/ > ruby-1.9.2-p0/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:533:in > `rescue in block in build_extensions': ERROR: Failed to build gem > native extension. (Gem::Installer::ExtensionBuildError)

> but $ gem install json > installs 1.5.1 without a probelm

After you do this and you then run 'bundle install' do you still get the error?

Yes still same.

Also, are you using a gemset with rvm? And just to be sure have you confirmed your rvm settings with 'rvm current'?

Using defaults (as out of the box) rvm current ruby-1.9.2-p0

Running gem install json (which is sucessful) and then bundle install the same error occurs

Running

gem install json (which is sucessful)

and then

bundle install

the same error occurs

I am not sure if this will work (also to answer your question, to diagnose ‘failed to compile native extensions’, usually just google and tends to have either to do with the OS or access rights)… I am guessing your problem is related to either the location that the gem is getting installed or due to the OS (i.e. such as 32 vs 64 bit)… that said, try this at the command prompt and then try bundle install again:

rvmsudo gem install json

Thank you David rvmsudo gem install json --> ok bundle install --> same error remains rvmsudo bundle install --> same error remains

I wonder if there is a OS package missing. However if I run this not as root but in my own user login then it works which suggests the OS has all packages required.

It would be really helpfull if bundle install wrote to a log or stdout what is missing. I do not understand how the output of bundle install can be used to diagnose what went wrong.

bundle help shows there is a command viz to show dependencies. xp:/var/www/html/registration/current# bundle viz #<LoadError: no such file to load -- graphviz> Make sure you have the graphviz ruby gem. You can install it with: `gem install ruby-graphviz`

After gem install ruby-graphviz it still gives the same LoadError

I think I make a wrong assumptions about execution environments and do not know enough.

Ernst

Tried gem install rvm gem install bundle install rvm wrapper ruby-1.9.2-p0

and in the end rebooted linux.

Now bundle install works and I get much further

Sorry I do not know why and how