Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing libv8 for ree on Mountain Lion fails

I've been trying to find a solution to this for a few days now and no luck. If anyone has been successful installing the libv8 gem for REE 1.8.7 on ML, could you please let me know the process you followed?

I have both the XCode LLVM compiler as well as the kennethreitz GCC package for 10.7+ v2 installed.

The output when trying to install with native extensions is:

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

        /Users/XXXXX/.rvm/rubies/ree-1.8.7-2012.02/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=/Users/XXXXX/.rvm/rubies/ree-1.8.7-2012.02/bin/ruby
extconf.rb:13: uninitialized constant Gem (NameError)
Checking for Python...

Gem files will remain installed in /Users/XXXXX/.rvm/gems/ree-1.8.7-2012.02/gems/libv8-3.3.10.4 for inspection.
Results logged to /Users/XXXXX/.rvm/gems/ree-1.8.7-2012.02/gems/libv8-3.3.10.4/ext/libv8/gem_make.out

(The results logged are the exact same as the error).

like image 755
Daniel Avatar asked May 07 '12 16:05

Daniel


2 Answers

This worked for me.

RUBYOPT=-rrubygems gem install therubyracer
like image 200
David Clarke Avatar answered Nov 17 '22 06:11

David Clarke


I was able to successfully install the libv8 gem on Mountain Lion on a freshly installed ree-1.8.7. I believe the issue you're seeing stems from the GCC version being used.

As is now described in the osx-gcc-installer's README you should switch from Kenneth Reitz's LLVM-version of GCC to the GCC 4.2 that is available via Homebrew or Macports.

Homebrew instructions: http://coderwall.com/p/dtbuqg

MacPorts instructions: http://coderwall.com/p/pagj2w

Note that you will want to set the CC path and establish the necessary symlink as described in those articles.

like image 21
Kenny Johnston Avatar answered Nov 17 '22 04:11

Kenny Johnston