Search code examples
ruby-on-railsruby-on-rails-3rubygemsfreebsdbundle-install

Ruby On Rails Installation in FreeBSD OS -Error in libv8


Am using FreeBSd OS , When i try to install libv8,

gem install libv8

its throwing an error ...

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

        /usr/local/bin/ruby18 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=/usr/local/bin/ruby18
extconf.rb:13: uninitialized constant Gem (NameError)
Checking for Python...


extconf.rb:13: uninitialized constant Gem 

I have icluded

gem 'therubyracer'
gem 'libv8', '3.3.10.4'

in gem file ..


Solution

  • This could happen in Ruby 1.8.7 which doesn't automatically include ruby gems like 1.9.x does. There is an update in github here: https://github.com/fractaloop/libv8/blob/master/ext/libv8/extconf.rb

    But this doesn't seem to be in the published gem at this time. It should be as easy as installing like this:

    gem 'libv8', :git => 'git://github.com/fractaloop/libv8.git'
    

    But from looking at the source, it dynamically associates the gem version with a version of the v8 library, and when i tried it, it failed, saying it was version 0.0.4. I'm on a different OS though, so try it out and see if it works for you.