2012年5月3日 星期四

Rails: bundle install ; gem install json 發生問題

bundle install 提示缺少json 1.7.0
安裝 json 
gem install json -v '1.7.0'
發生錯誤
"""
$ gem install json     
Building native extensions.  This could take a while...
ERROR:  Error installing json:
        ERROR: Failed to build gem native extension.

        c:/Ruby193/bin/ruby.exe extconf.rb
creating Makefile

make
generating parser-i386-mingw32.def
compiling parser.c
cc1.exe: error: unrecognized command line option "-Wno-missing-field-initializers"
make: *** [parser.o] Error 1


Gem files will remain installed in c:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.7.0 for inspection.

Results logged to c:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.7.0/ext/json/ext/parser/gem_make.out
"""
 檢查錯誤 出在 cc1.exe, 先拜Google
查出問題在於 Ruby - DevKit 版本 我安裝錯誤!!  裝到舊版本的DevKit了 XD

Requirements

  • Window XP or greater (32 or 64-bit).
  • A Ruby installation from RubyInstaller. This is important as it will not work with any other version of Ruby (e.g. old One-Click)
  • NOTE: for the legacy RubyInstaller v1.8.6 use the DevKit-3.4.5 available at our archive downloads page. For RubyInstaller versions 1.8.7, 1.9.2, and 1.9.3 use the DevKit 4.5.2 from our main downloads page.
  •  

Development Kit


安裝步驟

Extract Files

  • Left double-click the self-extracting executable (SFX) downloaded from Step 2 and choose a directory (without spaces) to install the DevKit artifacts into. For example, C:\DevKit. NOTE: the SFX is really a 7-Zip archive with a bit of embedded magic. If you already have 7-Zip installed, you can simply right-click it and extract its contents as you would a normal 7z archive. In the instructions that follow, the directory that you selected is identified as .
  • (翻白話) 點二下所下載的執行檔,並將解壓路徑設定為 C:\DevKit

Run Installation Scripts

  • cd from Step 3 above.
  • 切換路徑到 cd C:\Devkit
  • ruby dk.rb init to generate the config.yml file to be used later in this Step. Your installed Rubies will be listed there (only those installed by a RubyInstaller package are detected at present).
  • 執行 ruby dk.rb init
  • edit the generated config.yml file to include installed Rubies not automagically discovered or remove Rubies you do not want to use the DevKit with.
  • 提示 己自動變更config.yml檔案
  • [optional] ruby dk.rb review to review the list of Rubies to be enhanced to use the DevKit and verify the changes you made to it are correct.
  • 自選執行  ruby dk.rb review
  • finally, ruby dk.rb install to DevKit enhance your installed Rubies. This step installs (or updates) an operating_system.rb file into the relevant directory needed to implement a RubyGems pre_install hook and a devkit.rb helper library file into \lib\ruby\site_ruby. NOTE: you may need to use the --force option to update (with backup of the originals) the above mentioned files as discussed at the SFX DevKit upgrade FAQ entry.
  • 最後步驟 執行 ruby dk.rb install  開始安裝DevKit!!

Test Installation

  • Confirm your Ruby environment is correctly using the DevKit by running gem install rdiscount --platform=ruby. RDiscount should install correctly and you should see Temporarily enhancing PATH to include DevKit... in the screen messages. Next run ruby -rubygems -e "require 'rdiscount'; puts RDiscount.new('**Hello RubyInstaller**').to_html" to confirm that the rdiscount gem is working.
  • 測試  gem install rdiscount --platform=ruby  第二步驟..省略




安裝流程
C:\DevKit>ruby dk.rb init
[INFO] found RubyInstaller v1.9.3 at C:/Ruby193

Initialization complete! Please review and modify the auto-generated
'config.yml' file to ensure it contains the root directories to all
of the installed Rubies you want enhanced by the DevKit.

C:\DevKit>ruby dk.rb review
Based upon the settings in the 'config.yml' file generated
from running 'ruby dk.rb init' and any of your customizations,
DevKit functionality will be injected into the following Rubies
when you run 'ruby dk.rb install'.

C:/Ruby193

C:\DevKit>ruby dk.rb install
[INFO] Updating convenience notice gem override for 'C:/Ruby193'
[INFO] Installing 'C:/Ruby193/lib/ruby/site_ruby/devkit.rb'

C:\DevKit>gem install rdiscount --platform=ruby
Fetching: rdiscount-1.6.8.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
Successfully installed rdiscount-1.6.8
1 gem installed
Installing ri documentation for rdiscount-1.6.8...
Installing RDoc documentation for rdiscount-1.6.8...
再回到發生錯誤的地方 # bundle install 應該就能跳過 cc1.exe的錯誤了^^萬歲

沒有留言: