问题已经累积了好久,期待能有人解决。
系统为 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
See
config.log' for more details
config.log 的详细内容见链接:https://gist.github.com/anonymous/5734645
checking whether the C compiler works
#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
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 这个包升级到最新了没?
要我的话果断换系统, redora 的一个教程 http://lidashuang.writings.io/articles/9a14421a-fedora18-install-ruby-dev-env
#20 楼 @zhangyuxiu 刚才那个链接提到两个修复方法,我都试不了,不知道会不会有严重后果:
grep -F CCACHE /etc/bashrc /etc/profile ~/.bash_profile ~/.bashrc /etc/profile.d/*sh
#21 楼 @zhangyuxiu 升级系统难道不是勇敢地 yum update 一下就可以了么?我猜的哈,我只用过 debian,升级很平滑的每天 apt-get update 就行了
你的 ccache 是不是这个用户没有权限?
或者你看一下
ls -l /var/cache/ccache/
应该看上面一级
你现在的用户有没有权限
#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.
#33 楼 @zhangyuxiu 如果你用 gnome-terminal,勾上这个
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...