Rails RVM 安装 Ruby 1.9.2 安装出错,如何解决啊。呜呜。。

zhangyuxiu · 2013年06月08日 · 最后由 dsmylv 回复于 2013年06月08日 · 10496 次阅读

问题已经累积了好久,期待能有人解决。

系统为 Fedora14,想在上面搭建 Rails3。目前已经安装了 RVM 1.20.13 (stable) 和 Ruby(1.8.7) 看网上的提示,接下来要安装 ruby 1.9.2。我执行了 rvm 1.9.2 后出现下面的问题:

[user@cloud-privacy /]$ rvm install 1.9.2 Searching for binary rubies, this might take some time. No binary rubies available for: fedora/14/i386/ruby-1.9.2-p320. Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies. Installing requirements for fedora, might require sudo password. ccache: failed to create /var/cache/ccache/tmp (Permission denied) Installing Ruby from source to: /home/user/.rvm/rubies/ruby-1.9.2-p320, this may take a while depending on your cpu(s)... ruby-1.9.2-p320 - #downloading ruby-1.9.2-p320, this may take a while depending on your connection... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 8770k 100 8770k 0 0 57435 0 0:02:36 0:02:36 --:--:-- 54846 ruby-1.9.2-p320 - #extracting ruby-1.9.2-p320 to /home/user/.rvm/src/ruby-1.9.2-p320 ruby-1.9.2-p320 - #extracted to /home/user/.rvm/src/ruby-1.9.2-p320 ruby-1.9.2-p320 - #configuring........ Error running './configure --prefix=/home/user/.rvm/rubies/ruby-1.9.2-p320 --disable- install-doc --enable-shared', please read /home/user/.rvm/log/ruby-1.9.2-p320/1370681828_configure.log There has been an error while running configure. Halting the installation.

其中,/home/user/.rvm/log/ruby-1.9.2-p320/1370681828_configure.log 日志内容如下:

checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking target system type... i686-pc-linux-gnu checking for gcc... gcc checking whether the C compiler works... no configure: error: in /home/user/.rvm/src/ruby-1.9.2-p320': configure: error: C compiler cannot create executables Seeconfig.log' for more details

config.log 的详细内容见链接:https://gist.github.com/anonymous/5734645

fedora 已经 18 了吧,旧版本的问题如果没人报 bug 就没人处理了。

找找 config.log,看内容

find .rvm -name config.log

#2 楼 @Rei 我找到了 config.log 文件(路径是:/home/user/.rvm/src/ruby-1.9.2-p320/config.log),可是里面内容好多啊,我完全看不懂。。。

贴到 https://gist.github.com/ ,然后链接贴过来

checking whether the C compiler works

这个文章看过了没? http://ruby-china.org/wiki/install_ruby_guide

ccache: failed to create /var/cache/ccache/tmp (Permission denied)

权限问题?

#5 楼 @huacnlee 我主要看的是这个文章:http://ruby-china.org/wiki/rvm-guide
恩,我看了下您给的文章,步骤 0 的依赖安装,因为我是 Fedora14 的系统,那么应该执行下面的命令,把所有需要的依赖都安装么?不知道 Ubuntu 和 Fedora 下面对应的包名都一样么?

sudo yum install -y build-essential openssl curl libcurl3-dev libreadline6 libreadline6-dev git zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev libxslt-dev autoconf automake libtool imagemagick libmagickwand-dev libpcre3-dev libsqlite3-dev libmysql-ruby libmysqlclient-dev

#8 楼 @zhangyuxiu yum search 各个包,名字应该类似,但很大可能不会完全一样……

#8 楼 @zhangyuxiu

sudo yum install gcc g++ make automake autoconf curl-devel openssl-devel zlib-devel httpd-devel apr-devel apr-util-devel sqlite-devel

自己搜索一下吧,网上到处都是这类东西

https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-centos-6

似乎是个 fedora 14 特定的问题 https://bugzilla.redhat.com/show_bug.cgi?id=651023

ccache 的环境变量把 cache 路径设到了你没有权限访问的地方,导致编译的时候写入失败。

ccache 这个包升级到最新了没?

#10 楼 @huacnlee 这些依赖包都要提前安装么,我记得曾经好像听说安装 RVM 的话,不是会简化这些依赖包的安装么。我记错了么?

#12 楼 @zhangyuxiu gcc g++ make automake autoconf 这些东西东西应该是要安装的

#11 楼 @Rei 使用 yum install ccache 重新下载升级么?

#14 楼 @zhangyuxiu 我对 fedora 不太熟。

#14 楼 @zhangyuxiu 怎么还不明白呢,fedora 就是 redhat 做出来让用户做小白鼠测试用的……

#13 楼 @huacnlee 需要安装的包,我都安装好了。但是上面的问题还是没有解决。。。

#17 楼 @aptx4869 可是,这个系统我已经用来很久了,而且还有别的系统在上面,如果迁移的话,也挺麻烦的。

#11 楼 @Rei 恩,已经将 ccache 升级为最新的了。可是问题还是没有解决啊。。。

#16 楼 @search 恩,貌似看上去 Fedora18 很方便啊。呜呜。只是迁移系统也好麻烦啊。

#20 楼 @zhangyuxiu 刚才那个链接提到两个修复方法,我都试不了,不知道会不会有严重后果:

  1. yum remove ccache
  2. 找出哪个配置把 ccache 路径设错的,修复它
grep -F CCACHE /etc/bashrc /etc/profile ~/.bash_profile ~/.bashrc /etc/profile.d/*sh

#16 楼 @search 我之前用过 Fedora16,发现好些命令和 Fedora14 都不同了。Fedora18 呢?与 Fedora14 会有好些差别么?

#21 楼 @zhangyuxiu 升级系统难道不是勇敢地 yum update 一下就可以了么?我猜的哈,我只用过 debian,升级很平滑的每天 apt-get update 就行了

你的 ccache 是不是这个用户没有权限? 或者你看一下 ls -l /var/cache/ccache/ 应该看上面一级 你现在的用户有没有权限

#24 楼 @aptx4869 恩,应该都可以的吧。update 是更新,install 的话,如果发现了更新版,也会提示安装的。

#23 楼 @zhangyuxiu 只要是 linux,命令都一样,还 18 吧

#26 楼 @zhangyuxiu 你真的可以 勇敢地 试一下,如果没意外的话,就可以重装别的发行版了……

#25 楼 @ZombieCoder 恩,/tmp 的权限是:drwxrwsr-x. 2 root ccache 4096 9 月 14 2012 tmp,那我把权限改成:drwxrwsrwx 么?

你可以试试

#29 楼 @zhangyuxiu 提示说的是:ccache: failed to create /var/cache/ccache/tmp (Permission denied) 应该是:ccache 文件夹没有写权限。我修改了 ccache 文件夹的权限,之后问题就解决了。现在已经安装好 ruby 1.9.2 了。

太感谢了!Thank you!

看状况,目前 rvm install 1.9.2 已经安装好了。 [user@cloud-privacy ccache]$ rvm install 1.9.2 Searching for binary rubies, this might take some time. No binary rubies available for: fedora/14/i386/ruby-1.9.2-p320. Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies. Installing requirements for fedora, might require sudo password. Installing Ruby from source to: /home/user/.rvm/rubies/ruby-1.9.2-p320, this may take a while depending on your cpu(s)... ruby-1.9.2-p320 - #downloading ruby-1.9.2-p320, this may take a while depending on your connection... ruby-1.9.2-p320 - #extracted to /home/user/.rvm/src/ruby-1.9.2-p320 (already extracted) ruby-1.9.2-p320 - #configuring................................................................................................................................................................................................................................................................................................................................................................................................................................ ruby-1.9.2-p320 - #compiling............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................ ruby-1.9.2-p320 - #installing .................... Retrieving rubygems-1.8.25 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 371k 100 371k 0 0 29039 0 0:00:13 0:00:13 --:--:-- 30716 Extracting rubygems-1.8.25 ... Removing old Rubygems files... Installing rubygems-1.8.25 for ruby-1.9.2-p320................... Installation of rubygems completed successfully. Saving wrappers to '/home/user/.rvm/wrappers/ruby-1.9.2-p320'........

ruby-1.9.2-p320 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake). ruby-1.9.2-p320 - #importing default gemsets, this may take time....................... Install of ruby-1.9.2-p320 - #complete

可是,ruby -v 之后,还是只能看到 ruby 1.8.7 的版本。 我使用:rvm use 1.9.2 想设置使用 ruby 1.9.2 可是,出现下述问题: [user@cloud-privacy ccache]$ rvm use 1.9.2

RVM is not a function, selecting rubies with 'rvm use ...' will not work. You need to change your terminal emulator preferences to allow login shell. Sometimes it is required to use /bin/bash --login as the command. Please visit https://rvm.io/integration/gnome-terminal/ for a example.

ok. 可以了。在 Fedora14 下面的设置过程为:编辑——配置文件首选项——标题和命令——勾选“以登录 Shell 方式运行命令”

问题已经完全解决了。非常感谢以上各位的帮助!很开心。

I "rails testweb",then "cd testweb",then "ruby script/server"..and something goes wrong,here's the following description: => Booting WEBrick => Rails 2.3.14 application starting on http://0.0.0.0:3000 /usr/lib64/ruby/gems/1.8/gems/rails-2.3.14/lib/rails/gem_dependency.rb:21:in add_frozen_gem_path': undefined methodsource_index' for Gem:Module (NoMethodError) from /usr/lib64/ruby/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:298:in add_gem_load_paths' from /usr/lib64/ruby/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:132:inprocess' from /usr/lib64/ruby/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:113:in send' from /usr/lib64/ruby/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:113:inrun' from /home/liuzhou/testweb/config/environment.rb:9 from /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:45:in gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:45:inrequire' from /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:182:in require' from /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:547:innew_constants_in' from /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:182:in require' from /usr/lib64/ruby/gems/1.8/gems/rails-2.3.14/lib/commands/server.rb:84 from /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:45:ingem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:45:in `require' from script/server:3

thank you for you help...

需要 登录 后方可回复, 如果你还没有账号请 注册新账号