尝试在ubuntu 14.04.3 LTS上使用rbenv安装ruby v 2.2.2时生成失败错误

时间:2015-09-23 01:20:52

标签: ruby ubuntu rbenv

我在安装rbenv之后尝试安装ruby v2.2.2,但是我收到了这个错误。我是Ubuntu和Ruby的新手,想知道是否有办法解决这个问题。谢谢。

BUILD FAILED (Ubuntu 14.04 using ruby-build 20150818-4-g8d6ff29)

Inspect or clean up the working tree at /tmp/ruby-build.20150922205847.10469
Results logged to /tmp/ruby-build.20150922205847.10469.log

Last 10 log lines:
checking for gmp.h... no
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... 64
checking whether byte ordering is bigendian... no
checking for an ANSI C-conforming const... yes
checking whether char is unsigned... no
checking for inline... no
checking for working volatile... no
checking for typeof syntax and keyword spelling... __typeof__
configure: error: ANSI C-conforming const and volatile are mandatory

我也做了以下,但无济于事:

udo apt-get install autoconf bison build-essential libssl-dev libyaml-dev         libreadline6 libreadline6-dev zlib1g zlib1g-dev

2 个答案:

答案 0 :(得分:1)

这是由GCC版本不匹配引起的。你有GCC版本是"太新"对于这个特定的Ruby版本。以下是如何克服这个问题。

rbenv

motionMgr.startDeviceMotionUpdates(to: OperationQueue()) { deviceMotion, error in // ... }

RVM

CFLAGS="-O2 -fno-tree-dce -fno-optimize-sibling-calls" rbenv install [your-version]

答案 1 :(得分:0)

这个问题似乎源于缺少包裹。

这个article详细介绍了如何在Ubuntu 14.04 Trusty Tahr"上设置Ruby On Rails。你的问题在"安装Ruby"文章的一部分。

首先,安装所有依赖项。

sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev

现在你可以使用rbenv来安装ruby:

rbenv install 2.2.2