Package installation / upgrade: libv8 (therubyracer) installation fails (with native extensions)

I recently wanted to upgrade my gem bundle, but ran into installation problems with libv8 (requirement for therubyracer):

  Installing libv8 (3.3.10.3) with native extensions /usr/local/rvm/rubies/ruby-1.9.3-head/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb//5252:in `rescue in block in build_extensions': ERROR: Failed
  to build gem native extension.  (Gem :: Installer :: ExtensionBuildError)

         /usr/local/rvm/rubies/ruby-1.9.3-head/bin/ruby extconf.rb 
 Checking for Python ... *** 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.

I found a problem report on gitub therubyracer website and it offers to uninstall and reinstall libv8, but this does not work on my Ubuntu 11.04 machine. Any ideas - or am I stuck with the old version for a while?

+25
ruby-on-rails gem
Nov 14 '11 at 18:42
source share
7 answers

Try this a bit:

gem 'therubyracer' gem 'libv8', '3.16.14.3' 

Gotta help.

Also better with the new package: gem install bundler --pre

+29
Nov 14 2018-11-11T00:
source share

I had a similar problem with my old old Ubuntu 10.04 (x64)

After I updated the Gemfile project, these gems

  gem 'libv8', '~> 3.11.8' gem "therubyracer", '>= 0.11.0beta1', :require => 'v8' 

But when I ran 'bundle install', I got an error

 Installing therubyracer (0.11.0beta1) with native extensions Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /home/sseletskyy/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb checking for main() in -lpthread... yes creating Makefile make compiling array.cc compiling script.cc compiling object.cc compiling constants.cc compiling signature.cc compiling value.cc compiling locker.cc compiling init.cc compiling heap.cc compiling date.cc compiling message.cc compiling accessor.cc compiling context.cc compiling exception.cc compiling backref.cc compiling trycatch.cc compiling gc.cc compiling handles.cc compiling stack.cc compiling template.cc compiling function.cc compiling primitive.cc compiling rr.cc compiling v8.cc compiling invocation.cc compiling string.cc compiling external.cc compiling constraints.cc linking shared-object v8/init.so /home/sseletskyy/.rvm/gems/ruby-1.9.3-p194/gems/libv8-3.11.8.2-x86_64-linux/vendor/v8/out/x64.release/obj.target/tools/gyp/libv8_base.a: could not read symbols: No such file or directory collect2: ld returned 1 exit status make: *** [init.so] Error 1 Gem files will remain installed in /home/sseletskyy/.rvm/gems/ruby-1.9.3-p194/gems/therubyracer-0.11.0beta1 for inspection. Results logged to /home/sseletskyy/.rvm/gems/ruby-1.9.3-p194/gems/therubyracer-0.11.0beta1/ext/v8/gem_make.out An error occured while installing therubyracer (0.11.0beta1), and Bundler cannot continue. Make sure that `gem install therubyracer -v '0.11.0beta1'` succeeds before bundling. 

Here is a list of steps that helped me quickly solve this block.

  • Uninstall all versions of gem libv8 and therubyracer

    > gem remove therubyracer

    > gem remove libv8

  • Set breaker manually

    > gem install therubyracer

    Extract: libv8-3.3.10.4-x86_64-linux.gem (100%) Extract: therubyracer-0.10.1.gem (100%) Create your own extensions. This may take some time ... Successfully installed libv8-3.3.10.4-x86_64-linux Successfully installed therubyracer-0.10.1 2 stones installed Installing ri documentation for libv8-3.3.10.4-x86_64-linux ... Installing ri documentation for therubyracer-0.10.1 ... Installing the RDoc documentation for libv8-3.3.10.4-x86_64-linux ... Installing the RDoc documentation for therubyracer-0.10.1 ...

  • Check versions of installed stones

    gemstones list | grep libv

    libv8 (3.3.10.4 x86_64-linux)

    gemstones list | grep therubyracer

    therubyracer (0.10.1)

  • Install these versions in the gemfile and run

    bundle install

  • Summary. Well, I understand that in my case I did not use the latest versions, and this can be bad for security. But at least I could continue the development.

+29
Jul 02 2018-12-12T00:
source share

Ubuntu 11.04

 gem "therubyracer", '0.11.1' gem 'libv8' 
  • Remove therubyracer and libv8 gem

  • Update gemer version for newsletter

  • Install lib8-dev package

    sudo apt-get install libv8-dev

  • Then run this

    sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git -core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtag bm libmagickcore-dev libmagickwand-dev

  • Now set the breaker manually

    gem install therubyracer

  • It will install therubyracer and libv8 for you.

  • Now run the package installation

All of the above steps solved my problem :)

+7
May 15 '13 at 19:58
source share

I recently ran into the same problem. Here is some useful information from the RoR.org Rails Getting Started Guide:

Compiling CoffeeScript to JavaScript requires JavaScript runtime, and lack of runtime will give you an execjs error. Typically, Mac OS X and Windows come with JavaScript installed. Rails adds therubyracer gem to the Gemfile in the comments for new apps, and you can uncomment if you need it. therubyrhino is the recommended runtime for JRuby users and is added by default to the Gemfile application created in JRuby. You can explore all the supported runtimes in ExecJS.

Based on what I read elsewhere, it seems that Windows support for therubyracer gem does not exist in version "3.3.10.4" (possibly in a later version, although it has not been read, although far away). I installed python 2.7 and got it for compilation, but you still get errors later in the environment setup process.

So it all comes down to this. Check the terminology documentation here . "therubyracer" provides these functions (:

  • Evaluate Javascript with Ruby
  • Insert your Ruby objects into the Javascript world
  • Manipulate JavaScript objects and call JavaScript functions from Ruby
  • The Ruby Rhino compatible API (for JRuby: http://github.com/cowboyd/therubyrhino )

If you NEED TO CONFIRM these features, you should switch to * nix and abandon Windows for the development / production environment. Otherwise, you can do what I did and not install "therubyracer" or "libv8" (removed from my Gemfile). I do not rely heavily on JavaScript with the site I ran into this problem, so I just ignored both gems and everything seems good (for now).

Hope this helps someone else need it!

+1
Oct 03
source share

Ubuntu 12.04

 gem 'libv8', '3.11.8.3' gem 'therubyracer', '0.11.0beta5' 

Specifying the versions above solved my problem with therubyracer.

As above, I used the last kit:

 gem install bundler --pre 
+1
Mar 26 '13 at 2:47 on
source share

Be sure to specify the ruby ​​in the Gemfile

 gem 'therubyracer', :platform => :ruby 

and then run bundle update .

0
Aug 14
source share

Using these terminal commands fixed this for me on Ubuntu 16.04

 sudo apt-get install g++ sudo apt-get install build-essential 
0
Oct 16 '16 at 17:57
source share



All Articles