簡體   English   中英

無法安裝Rails extconf.rb失敗

[英]Unable to install Rails extconf.rb failed

我是Ruby on Rails的新手,我在安裝時遇到了以下錯誤。

請注意,我已經安裝了最新的Xcode和已安裝的命令行工具,我正在使用OSX 10.8.4。 我也安裝了Ruby 2.0.0。

-bash-3.2$ sudo gem install rails
Password:
Building native extensions.  This could take a while...
ERROR:  Error installing rails:
ERROR: Failed to build gem native extension.

/Users/WillieTran/.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/WillieTran/.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/WillieTran/.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/WillieTran/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:519:in `try_link0'
from /Users/WillieTran/.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/WillieTran/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/atomic-1.1.12 for inspection.
Results logged to /Users/WillieTran/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/atomic-1.1.12/ext/gem_make.out

我有類似的問題,它通過安裝命令行工具得到解決:

xcode-select --install

符號化並沒有為我解決問題。 我通過鍵入rvm uninstall ruby-2.0.0了我之前使用rvm uninstall ruby-2.0.0 ,然后輸入了rvm requirements 這個命令發現我需要一些其他的東西,比如gcc46。 奇怪的是,即使我已經安裝了xcode命令行工具,也需要gcc編譯器,並且gcc絕對安裝在我的系統上。

因此,如果通常的方法都不起作用,請給出rvm requirements

我想這個問題也是同樣的問題。

再次嘗試sudo ln -s /usr/bin/{llvm-,}gcc-4.2gem install rails

順便說一下,你在自己的主目錄中,你不必使用sudo

我剛剛使用ruby 2.5.3遇到了這個問題並且可以通過調用來安裝cairo:

PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig gem install cairo -v '1.15.2'

花了一段時間找到rvm東西,因為我已經安裝了命令行工具,並且使用的是asdf而不是rvm

感謝這個線程幫助修復: https//github.com/ruby-gnome2/ruby-gnome2/issues/259#issuecomment-59751807

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM