首页 文章

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

提问于
浏览
26

我最近想更新我的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.

我找到了issue report on therubyracer github site,它建议卸载并重新安装libv8,但这不适用于我的Ubuntu 11.04机器 . 任何想法 - 还是我坚持旧版本一段时间?

7 回答

  • 7

    尝试一下这一次:

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

    应该有所帮助

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

  • 1

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

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

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

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

    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.
    

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

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

    gem uninstall therubyracer> gem uninstall libv8

    • 手动安装therubyracer

    gem install 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文档...

    • 检查已安装宝石的版本

    gem list | grep libv libv8(3.3.10.4 x86_64-linux)> gem list | grep therubyracer therubyracer(0.10.1)

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

    捆绑安装

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

    Ubuntu 11.04

    gem "therubyracer", '0.11.1'
    gem 'libv8'
    
    • 卸载therubyracer和libv8 gem

    • 更新bundler gem版本

    • 安装lib8-dev软件包

    sudo apt-get install libv8-dev

    • 然后运行它

    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

    • 现在手动安装therubyracer

    宝石安装therubyracer

    • 它将为您安装therubyracer和libv8 .

    • 现在运行bundle install

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

  • 1

    我最近遇到了同样的问题 . 以下是RoR.org“Rails入门”指南中的一些有用信息:

    将CoffeeScript编译为JavaScript需要JavaScript运行时,如果没有运行时,则会出现execjs错误 . 通常,Mac OS X和Windows都安装了JavaScript运行时 . Rails在一个注释行中为新应用添加了therubyracer gem到Gemfile,如果需要,你可以取消注释 . therubyrhino是JRuby用户的推荐运行时,默认情况下添加到JRuby下生成的应用程序中的Gemfile . 您可以在ExecJS上调查所有支持的运行时 .

    基于我在其他地方读到的内容,似乎Windows对“热带分析器”宝石的支持并不存在于“3.3.10.4”版本中(可能是在更新的版本中,但在那时还没有读过) . 我已经安装了python 2.7并让它进行编译,但是在环境设置过程中你仍会遇到错误 .

    所以归结为这个 . 查看therubyracer文档here . 'therubyracer'提供这些功能(:

    • 使用Ruby评估Javascript

    • 将您的Ruby对象嵌入到Javascript世界中

    • 操纵JavaScript对象并从Ruby调用JavaScript函数

    • API与The Ruby Rhino兼容(适用于JRuby:http://github.com/cowboyd/therubyrhino

    如果您绝对需要这些功能,那么您应该切换到* nix并删除Windows以用于开发/ 生产环境 环境 . 否则你可以做我做的事情,并选择不安装'therubyracer'或'libv8'(从我的Gemfile中删除) . 我不会严重依赖JavaScript我正在遇到这个问题的网站,所以我只是忽略了这两个宝石而且一切看起来都很好(到目前为止) .

    希望这有助于其他有需要的人!

  • 0

    Ubuntu 12.04

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

    指定上面的版本解决了我的therubyracer问题 .

    也像上面提到的那样,我使用了最新的捆绑:

    gem install bundler --pre
    
  • 29

    一定要参考 Gemfile 中的红宝石

    gem 'therubyracer', :platform => :ruby
    

    然后运行 bundle update .

  • 28

    使用这些终端命令在Ubuntu 16.04上为我修复了它

    sudo apt-get install g++
    sudo apt-get install build-essential
    

相关问题