bundle install/update:libv8(therubyracer)安装失败(带有本机扩展)

emr*_*ass 26 gem ruby-on-rails

我最近想更新我的gem包但遇到了libv8的安装问题(对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:552: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.

在therubyracer github网站上找到了问题报告,它建议卸载并重新安装libv8,但这不适用于我的Ubuntu 11.04机器.任何想法 - 还是我坚持旧版本一段时间?

Dmi*_*kin 29

尝试一下这一次:

gem 'therubyracer'
gem 'libv8', '3.16.14.3'
Run Code Online (Sandbox Code Playgroud)

应该有所帮助

使用新的捆绑包也更好: gem install bundler --pre

  • 在"捆绑更新"之后,这对我有用 (3认同)

Ser*_*kyy 29

我的老Ubuntu 10.04(x64)上有类似的问题

在我更新项目之后,Gemfile拥有了这些宝石

  gem 'libv8', '~> 3.11.8'
  gem "therubyracer", '>= 0.11.0beta1', :require => 'v8'
Run Code Online (Sandbox Code Playgroud)

但当我运行'捆绑安装'时,我收到了一个错误

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.
Run Code Online (Sandbox Code Playgroud)

这是一个有助于我快速解决该障碍的步骤列表

  1. 卸载所有版本的宝石'libv8'和'therubyracer'

    >宝石卸载therubyracer

    > gem uninstall libv8

  2. 手动安装therubyracer

    >宝石安装therubyracer

    获取:libv8-3.3.10.4-x86_64-linux.gem(100%)获取:therubyracer-0.10.1.gem(100%)构建本机扩展.这可能需要一段时间...已成功安装libv8-3.3.10.4-x86_64-linux已成功安装therubyracer-0.10.1已安装2个宝石安装libv8-3.3.10.4-x86_64-linux的ri文档...为therubyracer安装ri文档-0.10.1 ...为libv8-3.3.10.4-x86_64-linux安装RDoc文档...为therubyracer-0.10.1安装RDoc文档...

  3. 检查已安装宝石的版本

    >宝石清单| grep libv

    libv8(3.3.10.4 x86_64-linux)

    >宝石清单| grep therubyracer

    therubyracer(0.10.1)

  4. 在Gemfile中设置这些版本并运行

    >捆绑安装

  5. 摘要.我明白,在我的情况下,我没有使用最新的版本,它可能是兼容性的坏.但至少我可以继续发展.

  • 手动删除和安装这样的东西也是唯一对我有用的东西.我无法弄清楚为什么让Bundler安装宝石导致麻烦,但是当我手动这样做时,一切都很好. (2认同)

roh*_*m19 7

Ubuntu 11.04

gem "therubyracer", '0.11.1'
gem 'libv8'
Run Code Online (Sandbox Code Playgroud)
  1. 卸载therubyracer和libv8 gem

  2. 更新bundler gem版本

  3. 安装lib8-dev包

    sudo apt-get install libv8-dev

  4. 然后运行它

    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 libtool bison subversion imagemagick graphicsmagick libmagickcore-dev libmagickwand-dev

  5. 现在手动安装therubyracer

    宝石安装therubyracer

  6. 它将为您安装therubyracer和libv8.

  7. 现在运行bundle install

以上所有步骤解决了我的问题:)