2

为什么 RVM、Ruby 或 Rails 需要libc6-dev, ncurses-dev and libtool ?

在 Ubuntu 上运行rvm requirements给了我们:

Linux 的要求( DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.10
DISTRIB_CODENAME=maverick
DISTRIB_DESCRIPTION="Ubuntu 10.10" )

注意:'ruby' 代表 Matz 的 Ruby 解释器 (MRI) (1.8.X, 1.9.X)
这是原始/标准 Ruby 语言解释器
'ree' 代表 Ruby 企业版
'rbx' 代表 Rubinius

bash >= 4.1 需要
curl 需要
git (对于 ruby​​-head >= 1.7)
需要补丁(对于 1.8 rubies 和一些 ruby​​-head's)。

要安装 rbx 和/或 Ruby 1.9 head (MRI)(例如 1.9.2-head),您
必须先安装并使用 rvm 1.8.7。

附加依赖项:
# 对于 Ruby / Ruby HEAD(MRI、Rubinius 和 REE),安装以下内容:
ruby​​: /usr/bin/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 pkg-config

# 对于 JRuby,安装如下:
jruby: /usr/bin/apt-get install curl g++ openjdk-6-jre-headless
jruby-head: /usr/bin/apt-get install ant openjdk-6-jdk

# 对于 IronRuby,安装以下内容:
ironruby: /usr/bin/apt-get install curl mono-2.0-devel

为什么 RVM、Ruby 或 Rails 需要libc6-dev, ncurses-dev and libtool?

对于其他包裹,据我所知:

build-essential automake bison autoconf pkg-config用于从源代码编译
libreadline6 libreadline6-dev需要 irb 的 readline 支持
openssl libssl-dev需要 ruby​​ 的 SSL 支持
curl git-core subversion需要获取软件
zlib1g zlib1g-dev需要解压ruby​​gems
libyaml-dev需要 ruby​​ 的 YAML 支持
libsqlite3-dev sqlite3需要 sqlite 支持 rails
libxml2-dev libxslt-dev需要通过 nokogiri 解析 XML

想知道为什么 RVM 首先添加它们?
如果未安装这些软件包中的任何一个,哪些知名库会中断?
安装 ruby​​ 本身需要哪些软件包,以及 stdlib 即需要哪些软件包。yaml 还是 rexml ?

编辑:忘记 pkg-config
编辑:最后添加了一些问题

4

3 回答 3

2

libc6-dev 是 C 标准库开发文件。没有它们,任何有用的 C 代码都不太可能编译。由于 Ruby 是用 C 编写的,因此编译和构建 ruby​​ 本身需要这些。

我猜想编译irb需要ncurses。

我同意你提到的其他包的目的。

于 2012-11-30T09:08:27.777 回答
2

这些都是基本库,它们是您将来将使用的各种 gem 的依赖项。

 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

There may be a case like you will not require all the libraries in you m/c, though when you will install some gems, errors like

cannot build native extension

In those cases the required libraries are looked upon for the failed gem and installed. Libraries are installed only once and are totally different as compared to gems. The libraries present here are for

Git, mysql server, sqlite, curl etc.

I would suggest to install it in the beginning with sudo permissions using Sudo apt-get install. Hope this helps. Also as you try out new gems and plugins, you would be installing new libraries in future.

于 2012-11-30T10:17:40.710 回答
2

ruby comes with a set of extensions, some of them require additional packages, for example ncurses is needed for better console support (irb) - but is not required, pkg-config is needed for packages searching - most packages expose a configuration file which helps in finding proper paths for compilation ... and so on, here is list of all extensions: https://github.com/ruby/ruby/tree/trunk/ext ... although it's not the list of requirements - i can not find official ruby list of requirements.

于 2012-11-30T14:46:55.907 回答