3

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 ..

shingara
  • 46,608
  • 11
  • 99
  • 105
Shanib
  • 155
  • 1
  • 3
  • 13

1 Answers1

2

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.

Matt Connolly
  • 9,757
  • 2
  • 65
  • 61
  • For others looking into this, execjs works with other javascript runtimes. If you can't get rubyracer/libv8 working, try node.js out. This works a lot easier for me using OpenIndiana/OpenSolaris. – Matt Connolly Mar 02 '12 at 12:26