gem install:错误:无法构建gem本机扩展 [英] gem install: ERROR: Failed to build gem native extension

查看:554
本文介绍了gem install:错误:无法构建gem本机扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



当我安装Ruby时,它说我应该添加:

  $(ruby -rubygems -eputs Gem.user_dir)/ bin 

到我的路径中,我将它添加到.bashrc中



当我尝试gem安装rails或任何其他gem它给出了错误:无法构建gem原生扩展。这是完整的错误:

 错误:执行gem时(Gem :: FilePermissionError)
你不用没有/usr/lib/ruby/gems/2.0.0目录的写入权限。
[alexander @ localhost〜] $ sudo gem install rails - 无用户安装
构建原生扩展。这可能需要一段时间...
错误:安装rails出错:
错误:无法构建gem本机扩展。
$ b $ / usr / bin / ruby​​ extconf.rb
创建Makefile
$ b $ makeDESTDIR =
sh:make:找不到命令


Gem文件将保留安装在/usr/lib/ruby/gems/2.0.0/gems/atomic-1.1.10中进行检查。

当我看到这个错误时,我发现人们通过安装ruby-dev包来解决这个错误。这在Arch Linux中不存在。任何其他选项,我可以尝试?



预先感谢! 要构建本地扩展,您需要使用c ++编译器和工具。这很清楚地表明:

  sh:make:找不到命令
make 实用程序外,您显然需要编译器本身(例如 gcc )和公司。因此,

  sudo apt-get install gcc 

可以做到这一点。顺便说一句,正确建议的上述RVM方式肯定也需要构建工具。


I am using Arch Linux and installed Ruby (this is version 2.0.0).

When I installed Ruby it said I should add:

$(ruby -rubygems -e "puts Gem.user_dir")/bin

to my path, I added it to .bashrc

When I try to gem install rails or any other gem it gives the Error: Failed to build gem native extension. this is the full error:

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /usr/lib/ruby/gems/2.0.0 directory.
[alexander@localhost ~]$ sudo gem install rails --no-user-install
Building native extensions.  This could take a while...
ERROR:  Error installing rails:
ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb
creating Makefile

make "DESTDIR="
sh: make: command not found


Gem files will remain installed in /usr/lib/ruby/gems/2.0.0/gems/atomic-1.1.10 for inspection.

When I look this error up I see that people solve this error by installing ruby-dev packages, however this does not exist for Arch Linux. Any other option that I can try?

Thanks in advance!

解决方案

To build native extensions you need the c++-compiler and tools. This is said clearly:

sh: make: command not found

Except of make utility you obviously need the compiler itself (e. g. gcc) and company. Thus,

sudo apt-get install gcc 

will do the trick. BTW, the properly suggested above RVM-way will definitely require build-tools as well.

这篇关于gem install:错误:无法构建gem本机扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆