While setting up a new VM for a Rails app I ran into an error message while running bundle install. The error message:
Gem::Ext::BuilderError: ERROR: Failed to build gem native extension
Usually this means that there is an error compiling a binary for the gem. But from the error below it appeared there was a problem with my python version.
creating Makefile Compiling v8 for ia32 Using python 2.4.3 Using compiler: /usr/bin/g++44 Traceback (most recent call last): File "build/gyp/gyp", line 15, in ? import gyp File "build/gyp/pylib/gyp/__init__.py", line 8, in ? import gyp.input File "build/gyp/pylib/gyp/input.py", line 14, in ? import gyp.common File "build/gyp/pylib/gyp/common.py", line 395 with open(source_path) as source_file: ^ SyntaxError: invalid syntax
Since I had an older version of python installed, I figured I should upgrade it but after upgrading I got this error:
creating Makefile Compiling v8 for ia32 Using python 3.1.5 Using compiler: /usr/bin/g++44 File "build/gyp/gyp", line 12 except ImportError, e: ^ SyntaxError: invalid syntax
gem install libv8 -v '220.127.116.11' -- --with-system-v8
Lo and behold everything worked and installed properly. Yay!