在Ubuntu 10.04中安装RSRuby[英] installing RSRuby in Ubuntu 10.04

本文是小编为大家收集整理的关于在Ubuntu 10.04中安装RSRuby的处理方法,想解了在Ubuntu 10.04中安装RSRuby的问题怎么解决?在Ubuntu 10.04中安装RSRuby问题的解决办法?那么可以参考本文帮助大家快速定位并解决问题。

问题描述

我正在尝试在 Ubuntu 10.04 上安装 RSRuby.我什至几乎不知道要报告哪些错误消息作为相关错误消息;我刚刚在谷歌上搜索了几个小时,但我尝试的命令都没有解决问题.

以下是一些示例错误消息:

$ sudo gem install rsruby -- --with-R-dir=/usr/lib/R
Building native extensions.  This could take a while...
ERROR:  Error installing rsruby:
    ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb --with-R-dir=/usr/lib/R
checking for main() in -lR... yes
checking for R.h... no

ERROR: Cannot find the R header, aborting.


Gem files will remain installed in /var/lib/gems/1.8/gems/rsruby-0.5.1.1 for inspection.
Results logged to /var/lib/gems/1.8/gems/rsruby-0.5.1.1/ext/gem_make.out

或使用 apt-get:

$ sudo gem install rsruby --include-dependencies -- --with-R-dir=/usr/lib/R/lib64/R --with-R-lib=/usr/lib/R/lib64/R/bin --with-R-include=/usr/lib/R/lib64/R/include
INFO:  `gem install -y` is now default and will be removed
INFO:  use --ignore-dependencies to install only the gems you list
Building native extensions.  This could take a while...
ERROR:  Error installing rsruby:
    ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb --with-R-dir=/usr/lib/R/lib64/R --with-R-lib=/usr/lib/R/lib64/R/bin --with-R-include=/usr/lib/R/lib64/R/include
checking for main() in -lR... no

ERROR: Cannot find the R library, aborting.


Gem files will remain installed in /var/lib/gems/1.8/gems/rsruby-0.5.1.1 for inspection.
Results logged to /var/lib/gems/1.8/gems/rsruby-0.5.1.1/ext/gem_make.out

我还从 GitHub 获得了最新的 RSRuby,并按照其 2006 PDF 手册中的说明进行操作:

$ ruby setup.rb config -- --with-R-dir=/usr/lib/R
---> lib
---> lib/rsruby
<--- lib/rsruby
<--- lib
---> ext
/usr/bin/ruby1.8 /home/mars/R/rsruby/ext/extconf.rb --with-R-dir=/usr/lib/R
checking for main() in -lR... yes
checking for R.h... no

ERROR: Cannot find the R header, aborting.
*** /home/mars/R/rsruby/ext/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.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=/home/mars/R/rsruby/ext
    --curdir
    --ruby=/usr/bin/ruby1.8
    --with-R-dir
    --with-R-include
    --without-R-include=${R-dir}/include
    --with-R-lib
    --without-R-lib=${R-dir}/lib
    --with-Rlib
    --without-Rlib
setup.rb:655:in `command': system("/usr/bin/ruby1.8" "/home/mars/R/rsruby/ext/extconf.rb" "--with-R-dir=/usr/lib/R") failed (RuntimeError)
    from setup.rb:660:in `ruby'
    from setup.rb:1238:in `extconf'
    from setup.rb:1230:in `config_dir_ext'
    from setup.rb:1532:in `__send__'
    from setup.rb:1532:in `traverse'
    from setup.rb:1549:in `dive_into'
    from setup.rb:1530:in `traverse'
    from setup.rb:1524:in `exec_task_traverse'
    from setup.rb:1519:in `each'
    from setup.rb:1519:in `exec_task_traverse'
    from setup.rb:1223:in `exec_config'
    from setup.rb:991:in `exec_config'
    from setup.rb:826:in `__send__'
    from setup.rb:826:in `invoke'
    from setup.rb:773:in `invoke'
    from setup.rb:1578

在irb中:

irb(main):002:0> require 'RSRuby'
LoadError: no such file to load -- RSRuby
    from (irb):2:in `require'
    from (irb):2
    from :0
irb(main):003:0> rsruby
NameError: undefined local variable or method `rsruby' for main:Object
    from (irb):3
    from :0

有时我似乎能够得到一些看起来可以工作的东西,但仍然无法从 irb 命令行加载 rsruby.

$ sudo gem install rsruby --include-dependencies -- --with-R-dir=/usr/lib/R --with-R-lib=/usr/lib/R --with-R-include=/usr/share/R/include/
INFO:  `gem install -y` is now default and will be removed
INFO:  use --ignore-dependencies to install only the gems you list
Building native extensions.  This could take a while...
Successfully installed rsruby-0.5.1.1
1 gem installed
Installing ri documentation for rsruby-0.5.1.1...
Installing RDoc documentation for rsruby-0.5.1.1...

然后

$ irb
irb(main):001:0> require 'rsruby'
LoadError: no such file to load -- rsruby
    from (irb):1:in `require'
    from (irb):1
    from :0

Ruby 是 1.8.7 版,我今天做了 sudo apt-get install ruby1.8-dev,但我不确定这是否会使事情变得更糟、更好或没有改变.或者如果这在 ruby1.9 中会更容易.

R 正在工作.

推荐答案

我不懂日语,但这在 Ubuntu 10.10、ruby 1.9 上对我有用:http://d.hatena.ne.jp/cuspos/20090520/1242825057

# gem install rsruby-0.5.1.1.gem -- --with-R-dir=/usr/lib/R --with-R-include=/usr/share/R/include 
Building native extensions.  This could take a while...
Successfully installed rsruby-0.5.1.1
1 gem installed
# export R_HOME=/usr/lib/R
# irb 
irb(main):001:0> require 'rsruby'
=> true
irb(main):002:0>

本文地址:https://www.itbaoku.cn/post/786786.html