gem install: ERROR: Failed to build gem native extension

我与影子孤独终老i 提交于 2019-12-10 17:22:26

问题


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!


回答1:


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.




回答2:


try this commands

sudo apt-get install ruby1.9.1-dev build-essential

sudo apt-get install ruby-compass



来源:https://stackoverflow.com/questions/17385111/gem-install-error-failed-to-build-gem-native-extension

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!