rvm 安装 Ruby 1.9.3时错误: compiler cannot create executables

十二 31st, 2011
rvm install 1.9.3

报错

Installing yaml to /Users/Camel/.rvm/usr
ruby-1.9.3-p0 - #configuring
ERROR: Error running ' ./configure --prefix=/Users/Camel/.rvm/rubies/ruby-1.9.3-p0 --enable-shared --disable-install-doc --with-libyaml-dir=/Users/Camel/.rvm/usr ', please read /Users/Camel/.rvm/log/ruby-1.9.3-p0/configure.log
ERROR: There has been an error while running configure. Halting the installation.

解法

rvm install 1.9.3 --with-gcc=clang

原因未知,安装1.9.2没有问题,估计和xcode有关。

标签:
>>原创文章,欢迎转载。转载请注明:转载自Ruby迷,谢谢!
>>原文链接地址:rvm 安装 Ruby 1.9.3时错误: compiler cannot create executables
  1. AirSmile
    一 8th, 201215:42

    系统:Mac Os X Lion 10.7.2
    配置前安装Xcode4.2接下来安装GCC-10.7-v2.pkg剩下就是安装git-1.7.8.2-intel-universal-snow-leopard.dmg。
    安装Rvm 安装Ruby 1.9.3po 一切都很顺利。在配置Rails3总是出问题。。。。。。

    • 老宋
      一 8th, 201220:17

      改一下源吧:参考这里:http://rubyer.me/blog/1194
      如果还不行,把错误贴出来,我帮你查查^^

      • AirSmile
        一 8th, 201223:53

        Last login: Sun Jan 8 22:34:51 on ttys001
        AirmatoMacBook-Pro:~ airhua$ sudo rvm install 1.9.3 #安装Ruby 1.9.3-p0
        Fetching yaml-0.1.4.tar.gz to /Users/airhua/.rvm/archives
        Extracting yaml-0.1.4.tar.gz to /Users/airhua/.rvm/src
        Configuring yaml in /Users/airhua/.rvm/src/yaml-0.1.4.
        Compiling yaml in /Users/airhua/.rvm/src/yaml-0.1.4.
        Installing yaml to /Users/airhua/.rvm/usr
        Installing Ruby from source to: /Users/airhua/.rvm/rubies/ruby-1.9.3-p0, this may take a while depending on your cpu(s)…

        ruby-1.9.3-p0 – #fetching
        ruby-1.9.3-p0 – #extracting ruby-1.9.3-p0 to /Users/airhua/.rvm/src/ruby-1.9.3-p0
        ruby-1.9.3-p0 – #extracted to /Users/airhua/.rvm/src/ruby-1.9.3-p0
        ruby-1.9.3-p0 – #configuring
        ruby-1.9.3-p0 – #compiling
        ruby-1.9.3-p0 – #installing
        Retrieving rubygems-1.8.10
        Extracting rubygems-1.8.10 …
        Removing old Rubygems files…
        Installing rubygems-1.8.10 for ruby-1.9.3-p0 …
        Installation of rubygems completed successfully.
        ruby-1.9.3-p0 – adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
        ruby-1.9.3-p0 – #importing default gemsets (/Users/airhua/.rvm/gemsets/)
        Install of ruby-1.9.3-p0 – #complete
        ==============================================================================
        AirmatoMacBook-Pro:~ airhua$ rvm -v #显示当前RVM版本
        rvm 1.10.1 by Wayne E. Seguin ,
        Michal Papis [https://rvm.beginrescueend.com/]
        ==============================================================================
        AirmatoMacBook-Pro:~ airhua$ rvm –default use 1.9.3-p0 #设置1.9.3为默认版本
        Using /Users/airhua/.rvm/gems/ruby-1.9.3-p0
        ==============================================================================
        AirmatoMacBook-Pro:~ airhua$ rvm list default #查看当前版本设置信息
        Default Ruby (for new shells)
        ruby-1.9.3-p0 [ x86_64 ]
        ==============================================================================
        AirmatoMacBook-Pro:~ airhua$ rvm list #列出已安装的Ruby版本
        rvm rubies
        =* ruby-1.9.3-p0 [ x86_64 ]
        # => – current
        # =* – current && default
        # * – default
        ==============================================================================
        AirmatoMacBook-Pro:~ airhua$ rvm gemset create rails3 #创建一个名为rails3的gemset
        ‘rails3′ gemset created (/Users/airhua/.rvm/gems/ruby-1.9.3-p0@rails3).
        ==============================================================================
        AirmatoMacBook-Pro:~ airhua$ rvm gemdir #显示所在位置
        /Users/airhua/.rvm/gems/ruby-1.9.3-p0
        ==============================================================================
        AirmatoMacBook-Pro:~ airhua$ gem -v #显示gem当前版本
        1.8.10
        ==============================================================================
        AirmatoMacBook-Pro:~ airhua$ gem sources -l #显示源地址sources
        *** CURRENT SOURCES ***
        http://ruby.taobao.org/
        ==============================================================================
        AirmatoMacBook-Pro:~ airhua$ sudo gem update –system #更新当前版本的gem
        Updating rubygems-update
        Fetching: rubygems-update-1.8.13.gem (100%)
        Successfully installed rubygems-update-1.8.13
        Installing RubyGems 1.8.13
        RubyGems 1.8.13 installed
        == 1.8.13 / 2011-12-21
        * 1 bug fix:
        * Check loaded_specs properly when trying to satisfy a dep
        * 2 minor enhancements:
        * Remove using #loaded_path? for performance
        * Remove Zlib workaround for Windows build.
        ——————————————————————————
        RubyGems installed the following executables:
        /Users/airhua/.rvm/rubies/ruby-1.9.3-p0/bin/gem
        RubyGems system software updated
        ==============================================================================
        AirmatoMacBook-Pro:~ airhua$ gem list #显示gems包
        *** LOCAL GEMS ***
        bundler (1.0.21 ruby)
        rake (0.9.2)
        rubygems-update (1.8.13)
        ==============================================================================
        AirmatoMacBook-Pro:~ airhua$ sudo gem install rails –include-dependencies #安装Rails 3.13 最新版为:3.2.0.rc2
        INFO: `gem install -y` is now default and will be removed
        INFO: use –ignore-dependencies to install only the gems you list
        ERROR: While executing gem … (Gem::DependencyError)
        Unable to resolve dependencies: rails requires activesupport (= 3.1.3),
        actionpack (= 3.1.3), activerecord (= 3.1.3), activeresource (= 3.1.3),
        actionmailer (= 3.1.3), railties (= 3.1.3), bundler (~> 1.0)
        AirmatoMacBook-Pro:~ airhua$ gem sources -l #换了源地址还是无法安装Rails 我的宽带是长城ADSL
        *** CURRENT SOURCES ***
        http://ruby.taobao.org/
        ==============================================================================
        接下去就是无限Shift+上 回车 重复 sudo gem install rails –include-dependencies 终于可以连上服务器,继续更新
        AirmatoMacBook-Pro:~ airhua$ sudo gem install rails 3.1.3 –include-dependencies
        INFO: `gem install -y` is now default and will be removed
        INFO: use –ignore-dependencies to install only the gems you list
        Fetching: multi_json-1.0.4.gem (100%)
        Fetching: activesupport-3.1.3.gem (100%)
        Fetching: builder-3.0.0.gem (100%)
        Fetching: i18n-0.6.0.gem (100%)
        Fetching: activemodel-3.1.3.gem (100%)
        Fetching: rack-1.3.6.gem (100%)
        Fetching: rack-cache-1.1.gem (100%)
        Fetching: rack-test-0.6.1.gem (100%)
        Fetching: rack-mount-0.8.3.gem (100%)
        Fetching: hike-1.2.1.gem (100%)
        Fetching: tilt-1.3.3.gem (100%)
        Fetching: sprockets-2.0.3.gem (100%)
        Fetching: erubis-2.7.0.gem (100%)
        Fetching: actionpack-3.1.3.gem (100%)
        Fetching: arel-2.2.1.gem (100%)
        Fetching: tzinfo-0.3.31.gem (100%)
        Fetching: activerecord-3.1.3.gem (100%)
        Fetching: activeresource-3.1.3.gem (100%)
        Fetching: mime-types-1.17.2.gem (100%)
        Fetching: polyglot-0.3.3.gem (100%)
        Fetching: treetop-1.4.10.gem (100%)
        Fetching: mail-2.3.0.gem (100%)
        Fetching: actionmailer-3.1.3.gem (100%)
        Fetching: thor-0.14.6.gem (100%)
        Fetching: rack-ssl-1.3.2.gem (100%)
        Fetching: railties-3.1.3.gem (100%)
        Fetching: bundler-1.0.21.gem (100%)
        Fetching: rails-3.1.3.gem (100%)
        Successfully installed multi_json-1.0.4
        Successfully installed activesupport-3.1.3
        Successfully installed builder-3.0.0
        Successfully installed i18n-0.6.0
        Successfully installed activemodel-3.1.3
        Successfully installed rack-1.3.6
        Successfully installed rack-cache-1.1
        Successfully installed rack-test-0.6.1
        Successfully installed rack-mount-0.8.3
        Successfully installed hike-1.2.1
        Successfully installed tilt-1.3.3
        Successfully installed sprockets-2.0.3
        Successfully installed erubis-2.7.0
        Successfully installed actionpack-3.1.3
        Successfully installed arel-2.2.1
        Successfully installed tzinfo-0.3.31
        Successfully installed activerecord-3.1.3
        Successfully installed activeresource-3.1.3
        Successfully installed mime-types-1.17.2
        Successfully installed polyglot-0.3.3
        Successfully installed treetop-1.4.10
        Successfully installed mail-2.3.0
        Successfully installed actionmailer-3.1.3
        Successfully installed thor-0.14.6
        Successfully installed rack-ssl-1.3.2
        Successfully installed railties-3.1.3
        Successfully installed bundler-1.0.21
        Successfully installed rails-3.1.3
        ERROR: Could not find a valid gem ’3.1.3′ (>= 0) in any repository #未知错误
        28 gems installed
        Installing ri documentation for multi_json-1.0.4…
        Installing ri documentation for activesupport-3.1.3…
        Installing ri documentation for builder-3.0.0…
        unable to convert “\xF1″ from ASCII-8BIT to UTF-8 for README, skipping
        unable to convert “\xF1″ from ASCII-8BIT to UTF-8 for README.rdoc, skipping
        Installing ri documentation for i18n-0.6.0…
        Installing ri documentation for activemodel-3.1.3…
        Installing ri documentation for rack-1.3.6…
        Installing ri documentation for rack-cache-1.1…
        Installing ri documentation for rack-test-0.6.1…
        Installing ri documentation for rack-mount-0.8.3…
        Installing ri documentation for hike-1.2.1…
        Installing ri documentation for tilt-1.3.3…
        Installing ri documentation for sprockets-2.0.3…
        Installing ri documentation for erubis-2.7.0…
        Installing ri documentation for actionpack-3.1.3…
        Installing ri documentation for arel-2.2.1…
        Installing ri documentation for tzinfo-0.3.31…
        Installing ri documentation for activerecord-3.1.3…
        Installing ri documentation for activeresource-3.1.3…
        Installing ri documentation for mime-types-1.17.2…
        Installing ri documentation for polyglot-0.3.3…
        Installing ri documentation for treetop-1.4.10…
        Installing ri documentation for mail-2.3.0…
        Installing ri documentation for actionmailer-3.1.3…
        Installing ri documentation for thor-0.14.6…
        Installing ri documentation for rack-ssl-1.3.2…
        Installing ri documentation for railties-3.1.3…
        Installing ri documentation for bundler-1.0.21…
        Installing ri documentation for rails-3.1.3…
        file ‘lib’ not found
        Installing RDoc documentation for multi_json-1.0.4…
        Installing RDoc documentation for activesupport-3.1.3…
        Installing RDoc documentation for builder-3.0.0…
        unable to convert “\xF1″ from ASCII-8BIT to UTF-8 for README, skipping
        unable to convert “\xF1″ from ASCII-8BIT to UTF-8 for README.rdoc, skipping
        Installing RDoc documentation for i18n-0.6.0…
        Installing RDoc documentation for activemodel-3.1.3…
        Installing RDoc documentation for rack-1.3.6…
        Installing RDoc documentation for rack-cache-1.1…
        Installing RDoc documentation for rack-test-0.6.1…
        Installing RDoc documentation for rack-mount-0.8.3…
        Installing RDoc documentation for hike-1.2.1…
        Installing RDoc documentation for tilt-1.3.3…
        Installing RDoc documentation for sprockets-2.0.3…
        Installing RDoc documentation for erubis-2.7.0…
        Installing RDoc documentation for actionpack-3.1.3…
        Installing RDoc documentation for arel-2.2.1…
        Installing RDoc documentation for tzinfo-0.3.31…
        Installing RDoc documentation for activerecord-3.1.3…
        Installing RDoc documentation for activeresource-3.1.3…
        Installing RDoc documentation for mime-types-1.17.2…
        Installing RDoc documentation for polyglot-0.3.3…
        Installing RDoc documentation for treetop-1.4.10…
        Installing RDoc documentation for mail-2.3.0…
        Installing RDoc documentation for actionmailer-3.1.3…
        Installing RDoc documentation for thor-0.14.6…
        Installing RDoc documentation for rack-ssl-1.3.2…
        Installing RDoc documentation for railties-3.1.3…
        Installing RDoc documentation for bundler-1.0.21…
        Installing RDoc documentation for rails-3.1.3…
        file ‘lib’ not found
        ==============================================================================
        AirmatoMacBook-Pro:~ airhua$ rails -v #显示安装好的Rails 版本(查看时候显示错误,试一下重新安装Rails 3.1.3)
        /Users/airhua/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs’: Could not find rails (>= 0) amongst [bundler-1.0.21, bundler-1.0.21, rake-0.9.2, rubygems-update-1.8.13] (Gem::LoadError)
        from /Users/airhua/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec’
        from /Users/airhua/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems.rb:1202:in `gem’
        from /Users/airhua/.rvm/rubies/ruby-1.9.3-p0/bin/rails:18:in `’

        • 老宋
          一 9th, 201214:24

          “Installing RDoc documentation for rails-3.1.3…
          file ‘lib’ not found”
          很可能是G*F*W的问题。再骂一次!
          离线安装吧:首先下载gem: http://rubygems.org/gems/rails
          然后gem install -l rails-3.1.3gem
          如果还缺少其它gem,一个个离线下载后安装。

          • AirSmile
            一 9th, 201219:37

            找到了问题所在,在安装Rails时是不能用sudo。

  2. PikachuEXE
    一 1st, 201216:30

    本人坚持在Windows玩=w=

    • 老宋
      一 1st, 201218:14

      精神可嘉,Ruby如果不拥抱Windows只能是小众产品,我只是恰好买了Mac

  3. 老宋
    十二 31st, 201121:44

    http://stackoverflow.com/questions/8032824/cant-install-ruby-under-lion-with-rvm-gcc-issues
    yaml只是表相,xcode 4.2移除了 non-LLVM 版本的 GCC,而1.9.3安装时要这个版本的gcc才能编译。安装4.1版本的xcode没有问题

  4. messiahxu
    十二 31st, 201118:56

    是缺少 yaml 的库
    参考这里 http://kingplesk.org/archives/401