2013-08-27 137 views
2
Saads-Mac-Pro:~ SMD$ gem install rails 
Building native extensions. This could take a while... 
/Users/SMD/.rvm/rubies/ruby-2.0.0- p247/lib/ruby/site_ruby/2.0.0/rubygems/ext/builder.rb:54: warning: Insecure world writable dir /usr in PATH, mode 040777 
ERROR: Error installing rails: 
ERROR: Failed to build gem native extension. 

/Users/SMD/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb 
*** extconf.rb failed *** 
Could not create Makefile due to some reason, probably lack of necessary 
libraries and/or headers. Check the mkmf.log file for more details. You may 
need configuration options. 

Provided configuration options: 
--with-opt-dir 
--without-opt-dir 
--with-opt-include 
--without-opt-include=${opt-dir}/include 
--with-opt-lib 
--without-opt-lib=${opt-dir}/lib 
--with-make-prog 
--without-make-prog 
--srcdir=. 
--curdir 
--ruby=/Users/SMD/.rvm/rubies/ruby-2.0.0-p247/bin/ruby 
--with-atomic_reference-dir 
--without-atomic_reference-dir 
--with-atomic_reference-include 
--without-atomic_reference-include=${atomic_reference-dir}/include 
--with-atomic_reference-lib 
--without-atomic_reference-lib=${atomic_reference-dir}/ 
/Users/SMD/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError) 
You have to install development tools first. 
from /Users/SMD/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:519:in `try_link0' 
from /Users/SMD/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:817:in `try_run' 
from extconf.rb:24:in `<main>' 


Gem files will remain installed in /Users/SMD/.rvm/gems/ruby-2.0.0-p247/gems/atomic-1.1.13 for inspection. 
Results logged to /Users/SMD/.rvm/gems/ruby-2.0.0-p247/gems/atomic-1.1.13/ext/gem_make.out 

这是我运行此命令时的输出gem install rails。我究竟做错了什么? 由于提前导轨安装时出错

编辑:输出gem env

Saads-Mac-Pro:~ SMD$ gem env 
RubyGems Environment: 
    - RUBYGEMS VERSION: 2.0.7 
    - RUBY VERSION: 2.0.0 (2013-06-27 patchlevel 247) [x86_64-darwin12.3.0] 
    - INSTALLATION DIRECTORY: /Users/SMD/.rvm/gems/ruby-2.0.0-p247 
    - RUBY EXECUTABLE: /Users/SMD/.rvm/rubies/ruby-2.0.0-p247/bin/ruby 
    - EXECUTABLE DIRECTORY: /Users/SMD/.rvm/gems/ruby-2.0.0-p247/bin 
    - RUBYGEMS PLATFORMS: 
    - ruby 
    - x86_64-darwin-12 
    - GEM PATHS: 
    - /Users/SMD/.rvm/gems/ruby-2.0.0-p247 
    - /Users/SMD/.rvm/gems/[email protected] 
    - GEM CONFIGURATION: 
    - :update_sources => true 
    - :verbose => true 
    - :backtrace => false 
    - :bulk_threshold => 1000 
    - REMOTE SOURCES: 
    - https://rubygems.org/ 
+0

希望你需要安装'开发kit' ..感谢 –

+0

你能更具体吗?我已经安装了xcode命令行工具!我还需要什么? –

+0

@RajarshiDas请帮忙。 –

回答

5

以下各种文章后,我想出了它。

以下是步骤。

$rvm get head

$rvm --force 2.0.0

​​

$gem install rails

经历顺利。

以下是输出:

Saads-Mac-Pro:~ SMD$ gem install rails 

Building native extensions. This could take a while... 

/Users/SMD/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/ext/builder.rb:54: warning: Insecure world writable dir /usr in PATH, mode 040777 
Successfully installed atomic-1.1.13 
Fetching: thread_safe-0.1.2.gem (100%) 
Successfully installed thread_safe-0.1.2 
Fetching: activesupport-4.0.0.gem (100%) 
Successfully installed activesupport-4.0.0 
Fetching: builder-3.1.4.gem (100%) 
Successfully installed builder-3.1.4 
Fetching: rack-1.5.2.gem (100%) 
Successfully installed rack-1.5.2 
Fetching: rack-test-0.6.2.gem (100%) 
Successfully installed rack-test-0.6.2 
Fetching: erubis-2.7.0.gem (100%) 
Successfully installed erubis-2.7.0 
Fetching: actionpack-4.0.0.gem (100%) 
Successfully installed actionpack-4.0.0 
Fetching: activemodel-4.0.0.gem (100%) 
Successfully installed activemodel-4.0.0 
Fetching: arel-4.0.0.gem (100%) 
Successfully installed arel-4.0.0 
Fetching: activerecord-deprecated_finders-1.0.3.gem (100%) 
Successfully installed activerecord-deprecated_finders-1.0.3 
Fetching: activerecord-4.0.0.gem (100%) 
Successfully installed activerecord-4.0.0 
Fetching: mime-types-1.24.gem (100%) 
Successfully installed mime-types-1.24 
Fetching: polyglot-0.3.3.gem (100%) 
Successfully installed polyglot-0.3.3 
Fetching: treetop-1.4.15.gem (100%) 
Successfully installed treetop-1.4.15 
Fetching: mail-2.5.4.gem (100%) 
Successfully installed mail-2.5.4 
Fetching: actionmailer-4.0.0.gem (100%) 
Successfully installed actionmailer-4.0.0 
Fetching: thor-0.18.1.gem (100%) 
Successfully installed thor-0.18.1 
Fetching: railties-4.0.0.gem (100%) 
Successfully installed railties-4.0.0 
Fetching: hike-1.2.3.gem (100%) 
Successfully installed hike-1.2.3 
Fetching: tilt-1.4.1.gem (100%) 
Successfully installed tilt-1.4.1 
Fetching: sprockets-2.10.0.gem (100%) 
Successfully installed sprockets-2.10.0 
Fetching: sprockets-rails-2.0.0.gem (100%) 
Successfully installed sprockets-rails-2.0.0 
Fetching: rails-4.0.0.gem (100%) 
Successfully installed rails-4.0.0 
Parsing documentation for atomic-1.1.13 
unable to convert "\xCF" from ASCII-8BIT to UTF-8 for lib/atomic_reference.bundle, skipping 
Installing ri documentation for atomic-1.1.13 
Parsing documentation for thread_safe-0.1.2 
Installing ri documentation for thread_safe-0.1.2 
Parsing documentation for activesupport-4.0.0 
unable to convert "\x80" from ASCII-8BIT to UTF-8 for lib/active_support/values/unicode_tables.dat, skipping 
Installing ri documentation for activesupport-4.0.0 
Parsing documentation for builder-3.1.4 
/Users/SMD/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rdoc/parser.rb:87: warning: Unsupported encoding : ignored 
/Users/SMD/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rdoc/parser.rb:87: warning: Unsupported encoding ignored 
Installing ri documentation for builder-3.1.4 
Parsing documentation for rack-1.5.2 
Installing ri documentation for rack-1.5.2 
Parsing documentation for rack-test-0.6.2 
Installing ri documentation for rack-test-0.6.2 
Parsing documentation for erubis-2.7.0 
Installing ri documentation for erubis-2.7.0 
Parsing documentation for actionpack-4.0.0 
Installing ri documentation for actionpack-4.0.0 
Parsing documentation for activemodel-4.0.0 
Installing ri documentation for activemodel-4.0.0 
Parsing documentation for arel-4.0.0 
Installing ri documentation for arel-4.0.0 
Parsing documentation for activerecord-deprecated_finders-1.0.3 
Installing ri documentation for activerecord-deprecated_finders-1.0.3 
Parsing documentation for activerecord-4.0.0 
Installing ri documentation for activerecord-4.0.0 
Parsing documentation for mime-types-1.24 
Installing ri documentation for mime-types-1.24 
Parsing documentation for polyglot-0.3.3 
Installing ri documentation for polyglot-0.3.3 
Parsing documentation for treetop-1.4.15 
Installing ri documentation for treetop-1.4.15 
Parsing documentation for mail-2.5.4 
unable to convert "\x80" from ASCII-8BIT to UTF-8 for lib/mail/values/unicode_tables.dat, skipping 
Installing ri documentation for mail-2.5.4 
Parsing documentation for actionmailer-4.0.0 
Installing ri documentation for actionmailer-4.0.0 
Parsing documentation for thor-0.18.1 
Installing ri documentation for thor-0.18.1 
Parsing documentation for railties-4.0.0 
Installing ri documentation for railties-4.0.0 
Parsing documentation for hike-1.2.3 
Installing ri documentation for hike-1.2.3 
Parsing documentation for tilt-1.4.1 
Installing ri documentation for tilt-1.4.1 
Parsing documentation for sprockets-2.10.0 
Installing ri documentation for sprockets-2.10.0 
Parsing documentation for sprockets-rails-2.0.0 
Installing ri documentation for sprockets-rails-2.0.0 
Parsing documentation for rails-4.0.0 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/belongs_to.png, skipping 
unable to convert "\xF4" from ASCII-8BIT to UTF-8 for guides/assets/images/book_icon.gif, skipping 
unable to convert "\x91" from ASCII-8BIT to UTF-8 for guides/assets/images/bullet.gif, skipping 
unable to convert "\xF5" from ASCII-8BIT to UTF-8 for guides/assets/images/chapters_icon.gif, skipping 
unable to convert "\xF5" from ASCII-8BIT to UTF-8 for guides/assets/images/check_bullet.gif, skipping 
unable to convert "\xF4" from ASCII-8BIT to UTF-8 for guides/assets/images/credits_pic_blank.gif, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/csrf.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/edge_badge.png, skipping 
unable to convert "\x9E" from ASCII-8BIT to UTF-8 for guides/assets/images/favicon.ico, skipping 
unable to convert "\x80" from ASCII-8BIT to UTF-8 for guides/assets/images/feature_tile.gif, skipping 
unable to convert "\x80" from ASCII-8BIT to UTF-8 for guides/assets/images/footer_tile.gif, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/fxn.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/getting_started/challenge.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/getting_started/confirm_dialog.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/getting_started/forbidden_attributes_for_new_post.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/getting_started/form_with_errors.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/getting_started/index_action_with_edit_link.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/getting_started/new_post.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/getting_started/post_with_comments.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/getting_started/rails_welcome.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/getting_started/routing_error_no_controller.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/getting_started/routing_error_no_route_matches.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/getting_started/show_action_for_posts.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/getting_started/template_is_missing_posts_new.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/getting_started/undefined_method_post_path.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/getting_started/unknown_action_create_for_posts.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/getting_started/unknown_action_new_for_posts.png, skipping 
unable to convert "\xF0" from ASCII-8BIT to UTF-8 for guides/assets/images/grey_bullet.gif, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/habtm.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/has_many.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/has_many_through.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/has_one.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/has_one_through.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/header_backdrop.png, skipping 
unable to convert "\x80" from ASCII-8BIT to UTF-8 for guides/assets/images/header_tile.gif, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/i18n/demo_html_safe.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/i18n/demo_localized_pirate.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/i18n/demo_translated_en.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/i18n/demo_translated_pirate.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/i18n/demo_translation_missing.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/i18n/demo_untranslated.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons/callouts/1.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons/callouts/10.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons/callouts/11.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons/callouts/12.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons/callouts/13.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons/callouts/14.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons/callouts/15.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons/callouts/2.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons/callouts/3.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons/callouts/4.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons/callouts/5.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons/callouts/6.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons/callouts/7.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons/callouts/8.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons/callouts/9.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons/caution.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons/example.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons/home.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons/important.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons/next.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons/note.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons/prev.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons/tip.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons/up.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/icons/warning.png, skipping 
unable to convert "\xFF" from ASCII-8BIT to UTF-8 for guides/assets/images/jaimeiniesta.jpg, skipping 
unable to convert "\xF5" from ASCII-8BIT to UTF-8 for guides/assets/images/nav_arrow.gif, skipping 
unable to convert "\xFF" from ASCII-8BIT to UTF-8 for guides/assets/images/oscardelben.jpg, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/polymorphic.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/radar.png, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/rails4_features.png, skipping 
unable to convert "\xFF" from ASCII-8BIT to UTF-8 for guides/assets/images/rails_guides_kindle_cover.jpg, skipping 
unable to convert "\xEC" from ASCII-8BIT to UTF-8 for guides/assets/images/rails_guides_logo.gif, skipping 
unable to convert "\x8C" from ASCII-8BIT to UTF-8 for guides/assets/images/rails_logo_remix.gif, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/session_fixation.png, skipping 
unable to convert "\x80" from ASCII-8BIT to UTF-8 for guides/assets/images/tab_grey.gif, skipping 
unable to convert "\x80" from ASCII-8BIT to UTF-8 for guides/assets/images/tab_info.gif, skipping 
unable to convert "\x80" from ASCII-8BIT to UTF-8 for guides/assets/images/tab_note.gif, skipping 
unable to convert "\x80" from ASCII-8BIT to UTF-8 for guides/assets/images/tab_red.gif, skipping 
unable to convert "\x80" from ASCII-8BIT to UTF-8 for guides/assets/images/tab_yellow.gif, skipping 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/tab_yellow.png, skipping 
unable to convert "\xFF" from ASCII-8BIT to UTF-8 for guides/assets/images/vijaydev.jpg, skipping 
Installing ri documentation for rails-4.0.0 
24 gems installed 

Sorry couldn't edit the terminal output. Too many lines!

1

得到了它。看看你的错误: -

'宝石文件仍将安装在/用户/ SMD/.rvm/gems/ruby​​-2.0.0-p247 /宝石/原子-1.1.13

供检查. so it is for gem name as原子and you required JAVA JDK 8 github.com/headius/ruby-atomic last line stated as of 1.1.0 , JDK8 需要建立原子宝石,因为它会尝试使用新的atomic`

请安装JDK 8

+0

我打算安装jdk,但我解决了它没有jdk –

+0

只是强制rvm安装2.0.0版本 –

+1

@SaadMassod没有JDK你能够安装'atomic'吗?和你以前的错误显示,“原子”问题 –

1
Parsing documentation for rails-4.0.0 
unable to convert "\x89" from ASCII-8BIT to UTF-8 for guides/assets/images/belongs_to.png, skipping 
unable to convert "\xF4" from ASCII-8BIT to UTF-8 for guides/assets/images/book_icon.gif, skipping 

这是RDoc的宝石的问题,我会发现这issue在github上。 更新rdoc宝石并重新安装导轨。

$ gem install rdoc 
$ gem install rails 
+0

它有什么影响。我的设置运行良好。? –

+0

我认为它只是关闭转换文档从ASCII到UTF的问题 –

+0

另外我发现这个问题与mkmf.rb http://kevinpotgieter.wordpress.com/2012/12/06/ruby-gem-install-mkmf-rb-无法找到头文件的红宝石问题/和这个堆栈问问http://stackoverflow.com/questions/12731904/rails-installation-failed-on-ubuntu-with-cannot-load-such-file- mkmf在os x for rails中,我们必须安装Xcode(他包含了很多libs),但是在linux下,基于bsd的操作系统我们必须手动安装需要的库并且很抱歉我的rus英语:) –

1

安装convmv 1.12-2(Ubuntu的12.04.3),解决

  • 无法从ASCII-8BIT转换 “\ X89” 以UTF-8为导向/资产/图像/ belongs_to的巴纽,跳绳
+0

这是一个安装gem或apt-得到命令?你使用了什么命令? –

2

这里有一个答案,帮助我:Ruby on Rails - unable to convert "\x89" from ASCII-8BIT to UTF-8 for xxx/xxxx/xxxx

您需要更新/安装这样一个版本支持转换的RDoc宝石。然后,在安装导轨或重新生成文档时,在生成文档时不会出现这些错误。

gem install rdoc 

然后重新生成文档

gem rdoc --all --overwrite 

然后做gem updategem install rails

同时,确保RVM是一个功能type rvm | head -1