How to install libv8 ruby โ€‹โ€‹gem on a new Mountain Lion installation?

I'm already puzzling over this. I followed the suggestions in several related posts, but to no avail.

I start with a new installation of Mountain Lion, install the command line tools, and successfully install Ruby 1.8.7 based on a few other messages that I found to install gcc-4.2 via Homebrew and add a symlink to / usr / bin / gcc -4.2.

Now, however, I cannot successfully install libv8. The error below is how far I retreated from the existing proposals.

Any additional input?

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /Users/Eric/.rbenv/versions/1.8.7-p352/bin/ruby extconf.rb creating Makefile Unable to find a compiler officially supported by v8. It is recommended to use GCC v4.4 or higher Traceback (most recent call last): File "build/gyp/gyp", line 18, in <module> sys.exit(gyp.main(sys.argv[1:])) File "build/gyp/pylib/gyp/__init__.py", line 480, in main generator.GenerateOutput(flat_list, targets, data, params) File "build/gyp/pylib/gyp/generator/make.py", line 2085, in GenerateOutput part_of_all=qualified_target in needed_targets) File "build/gyp/pylib/gyp/generator/make.py", line 756, in Write self.xcode_settings, self.Absolutify, self.Pchify)) File "build/gyp/pylib/gyp/generator/make.py", line 1132, in WriteSources cflags = self.xcode_settings.GetCflags(configname) File "build/gyp/pylib/gyp/xcode_emulation.py", line 258, in GetCflags sdk_root = self._SdkPath() File "build/gyp/pylib/gyp/xcode_emulation.py", line 247, in _SdkPath return os.path.join(self._GetSdkBaseDir(), '%s.sdk' % sdk_root) File "build/gyp/pylib/gyp/xcode_emulation.py", line 233, in _GetSdkBaseDir raise Exception('Error %d running xcode-select' % job.returncode) Exception: Error 2 running xcode-select make: *** [out/Makefile.x64] Error 1 Using compiler: g++ GYP_GENERATORS=make \ build/gyp/gyp --generator-output="out" build/all.gyp \ -Ibuild/standalone.gypi --depth=. \ -Dv8_target_arch=x64 \ -S.x64 -Dhost_arch=x64 xcode-select: Error: No Xcode is selected. Use xcode-select -switch <path-to-xcode>, or see the xcode-select manpage (man xcode-select) for further information. Gem files will remain installed in /Users/Eric/Development/par8o/vendor/bundle/ruby/1.8/gems/libv8-3.11.8.3 for inspection. Results logged to /Users/Eric/Development/par8o/vendor/bundle/ruby/1.8/gems/libv8-3.11.8.3/ext/libv8/gem_make.out An error occured while installing libv8 (3.11.8.3), and Bundler cannot continue. Make sure that `gem install libv8 -v '3.11.8.3'` succeeds before bundling. 
+7
source share
9 answers

The deal with ruby โ€‹โ€‹1.8.7. You may need this pearl to run therubyracer. And to complete this work, you need to install therubyracer gem as follows:

 RUBYOPT=-rrubygems gem install therubyracer 

This will install both jewels and libv8.

source: http://coderwall.com/p/y1djxq

+15
source

In my case, compilation failed due to problems with libtool. When installing the libv8 error was libtool: unrecognized option '-static' .

The problem was that my macports-Installation had a clearly broken libtool. And the macports-directory in $PATH was before the usual directories the wrong libtool is called.

Removing macports directories from the PATH-Environmentvariable did the trick: libtool from XCode , and everything went well.

+3
source

I had this problem and found a solution here

In short, install v8 yourself - if you have a home-brew, you can run

 brew install v8 

Then use v8 system during installation

 gem install libv8 -- --with-system-v8 
+3
source

After I had a problem with OS X 10.7.5, the following Gemfile entry worked for me:

 gem "libv8", '3.11.8.13' > ruby -v ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-darwin11.4.2] 
+2
source

Using the RUBYOPT = -rrubygems clause above worked for me, but first I needed to remove my existing therubyracer and libv8 cubes.

0
source

After many unsuccessful attempts by various methods, I finally downloaded Xcode and, as the error message shows, will do the trick

0
source

None of the above answers worked for me. That's what:

 gem install libv8 -v '3.11.8.3' gem install therubyracer -v '0.11.0beta5' 

ref: https://coderwall.com/p/s8ofka

My system:

 OSX Mountain Lion Ruby 1.9.3 
0
source

First try to fix the problem using:

 RUBYOPT=-rrubygems gem install therubyracer 

If the error persists, update your gems:

 bundle update 
0
source

Different gems require different versions of GCC, so this may or may not work for all gems, but these symbolic links solved the problem for json, eventmachine and libv8 gems on Mountain Lion with Xcode 4.4 installed.

sudo ln -s / usr / llvm-gcc-4.2 / bin / llvm-gcc-4.2 / usr / bin / gcc-4.2

sudo ln -s / usr / llvm-gcc-4.2 / bin / llvm-gcc-4.2 / usr / bin / g ++ - 4.2

-2
source

All Articles