Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 无法安装Rails extconf.rb失败_Ruby On Rails_Ruby - Fatal编程技术网

Ruby on rails 无法安装Rails extconf.rb失败

Ruby on rails 无法安装Rails extconf.rb失败,ruby-on-rails,ruby,Ruby On Rails,Ruby,我是RubyonRails的新手,在安装RubyonRails时遇到以下错误 请注意,我已经安装了最新的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 buil

我是RubyonRails的新手,在安装RubyonRails时遇到以下错误

请注意,我已经安装了最新的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
-bash-3.2$sudo gem安装rails
密码:
构建本机扩展。这可能需要一段时间。。。
错误:安装rails时出错:
错误:无法生成gem本机扩展。
/Users/WillieTran/.rvm/rubies/ruby-2.0.0-p247/bin/ruby-extconf.rb
***extconf.rb失败***
由于某些原因无法创建Makefile,可能缺少必要的
库和/或标题。有关详细信息,请查看mkmf.log文件。你可以
需要配置选项。
提供的配置选项:
--使用opt dir
--不带opt dir
--选择包含
--不带opt include=${opt dir}/include
--使用opt lib
--不带opt lib=${opt dir}/lib
--用make prog
--没有make prog
--srcdir=。
--库尔迪尔
--ruby=/Users/WillieTran/.rvm/rubies/ruby-2.0.0-p247/bin/ruby
--with-atomic_reference-dir
--无原子参考目录
--with-atomic_reference-include
--不带-atomic_reference-include=${atomic_reference-dir}/include
--with-atomic_reference-lib
--不带-atomic_reference-lib=${atomic_reference-dir}/
/Users/WillieTran/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:434:在“try_do”中:编译器未能生成可执行文件。(运行时错误)
您必须首先安装开发工具。
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'
来自extconf.rb:24:in`'
Gem文件仍将安装在/Users/WillieTran/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/atomic-1.1.12中以供检查。
结果记录到/Users/WillieTran/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/atomic-1.1.12/ext/gem_make.out

我想这和我的问题是一样的

再次尝试
sudo ln-s/usr/bin/{llvm-,}gcc-4.2
gem安装rails


顺便说一句,您在自己的主目录中,您不必使用
sudo

符号链接并没有为我解决问题。我通过键入
rvm uninstall ruby-2.0.0
卸载了我以前使用rvm安装的ruby,然后键入
rvm requirements
。这个命令发现我还需要一些其他的东西,比如gcc46。奇怪的是,尽管我已经安装了xcode命令行工具,而且gcc肯定安装在我的系统上,但仍然需要gcc编译器


因此,如果通常的方法都不起作用,那就试一试
rvm要求

我遇到了类似的问题,通过安装命令行工具解决了这个问题:

xcode-select --install

我刚刚在ruby 2.5.3中遇到了这个问题,可以通过调用:

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

我花了一段时间找到了一些有用的工具,因为我已经安装了命令行工具,并且正在使用
asdf
而不是
rvm


感谢此线程帮助修复:

你在
/Users/WillieTran/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/atomic-1.1.12/ext/gem\u-make.out中有什么问题?
我也遇到过同样的问题,gem\u-make.out只是他粘贴的文本版本。非常感谢。