简体   繁体   English

Gem :: Ext :: BuildError:错误:无法构建gem本机扩展。 -优胜美地

[英]Gem::Ext::BuildError: ERROR: Failed to build gem native extension. - Yosemite

I am using Rails 4. Bundle was working up until yesterday, when I had to reinstall Bundler because of a different error. 我正在使用Rails4。Bundle一直工作到昨天,由于另一个错误,我不得不重新安装Bundler。 Now, when I run "bundle install", a few gems are successfully installed and then I receive this error message: 现在,当我运行“捆绑安装”时,成功安装了一些gem,然后收到以下错误消息:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/usr/local/bin/ruby -r ./siteconf20150509-3462-k6ug3q.rb extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling generator.c
make: gcc-4.2: No such file or directory
make: *** [generator.o] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/local/lib/ruby/gems/2.0.0/gems/json-    1.8.2 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.0.0/extensions/x86_64-darwin-   10/2.0.0-static/json-1.8.2/gem_make.out
An error occurred while installing json (1.8.2), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.2'` succeeds before bundling.

I then try to 'gem install json -v '1.8.2' and get this error message: 然后,我尝试'gem install json -v'1.8.2'并得到以下错误消息:

Building native extensions.  This could take a while...
/usr/local/lib/ruby/site_ruby/2.0.0/rubygems/ext/builder.rb:73: warning:     
Insecure world writable dir /usr/local/lib/ruby/gems/2.0.0 in PATH, mode 040777
ERROR:  Error installing json:
ERROR: Failed to build gem native extension.

/usr/local/bin/ruby -r ./siteconf20150509-3898-12pmbxe.rb extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling generator.c
make: gcc-4.2: No such file or directory
make: *** [generator.o] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/local/lib/ruby/gems/2.0.0/gems/json-1.8.2 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.0.0/extensions/x86_64-darwin-    10/2.0.0-static/json-1.8.2/gem_make.out

I have no idea how to fix this. 我不知道该如何解决。 I have tried several solutions including: 我尝试了几种解决方案,包括:

-"rvm implode" -“ rvm内爆”

-"sudo gem update --system" -“ sudo gem更新--system”

-"sudo gem update --system --no-user-install" -“ sudo gem update --system --no-user-install”

-"sudo chmod 755 /usr/local/lib/ruby/gems/2.0.0/gems" -“ sudo chmod 755 /usr/local/lib/ruby/gems/2.0.0/gems”

-"xcode-select --install" -“ xcode-select --install”

-running Disk Repair 运行磁盘修复

I read a few things about making changes to the path and bash profile, but I am unclear on how to do that. 我阅读了一些有关更改路径和bash配置文件的内容,但不清楚如何执行此操作。

Thank you in advance! 先感谢您! Already spent 2 hours trying to solve this. 已经花了2个小时来解决这个问题。

Answered in this stack question : Insecure world writable dir /Users/username in PATH, mode 040777 when running Ruby commands 在此堆栈问题中得到回答: 运行Ruby命令时,PATH模式040777下的世界可写目录/ Users / username不安全

Your home folder should only be writable by you, not by anyone else. 您的主文件夹只能由您写,不能由其他任何人写。 The reason gem is complaining about this is that you have folders in your PATH that are inside your (insecure) home folder, and that means that anyone who wants to could hack you by renaming/moving your .rvm folder and replacing it with an impostor. gem抱怨此问题的原因是您的PATH文件夹位于(不安全的)主文件夹中,这意味着任何想通过重命名/移动.rvm文件夹并将其替换为冒名顶替者来入侵您的文件夹。 。

To fix your home folder, run chmod go-w /Users/kristoffer. 要修复您的主文件夹,请运行chmod go-w / Users / kristoffer。 If there are any other insecure folders on the way to anything in your PATH, you should fix them similarly. 如果在访问PATH中任何内容的途中还有其他不安全的文件夹,则应该以类似方式修复它们。

BTW, the reason that Disk Utility didn't repair this is that it only repairs files installed as part of the OS (see Apple's KB article on the subject). 顺便说一句,磁盘实用程序无法修复此问题的原因是,它只能修复作为操作系统一部分安装的文件(请参阅有关该主题的Apple知识库文章)。 There is an option to repair home folder permissions if you boot from the install DVD and run Password Reset from the Utilities menu, but I'm not sure if it resets the permissions themselves or just ownership. 如果您从安装DVD引导并从“实用工具”菜单运行“密码重置”,则有一个修复主文件夹权限的选项,但是我不确定它是重置权限本身还是只是所有权。

Update 更新

Installing a new version of Ruby seemed to work. 安装新版本的Ruby似乎可行。 Previously I was using 2.0.0, and now I upgraded to 2.2.2. 以前我使用2.0.0,现在我升级到2.2.2。 This seems to have made the issue go away. 这似乎使问题消失了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Gem :: Ext :: BuildError:错误:无法构建gem本机扩展。 GCC错误 - Gem::Ext::BuildError: ERROR: Failed to build gem native extension. GCC error Gem :: Ext :: BuildError:错误:无法构建gem本机扩展。 在CenOS 6.5上 - Gem::Ext::BuildError: ERROR: Failed to build gem native extension. on CenOS 6.5 Gem::Ext::BuildError:错误:无法构建 gem 本机扩展。 在 Ubuntu 22.04 - Gem::Ext::BuildError: ERROR: Failed to build gem native extension. on Ubuntu 22.04 Gem::Ext::BuildError: 错误:无法构建 gem 本机扩展。 对于 SQLite3 - Gem::Ext::BuildError: ERROR: Failed to build gem native extension. for SQlite3 Gem :: Ext :: BuildError:错误:无法构建gem原生扩展。 postgresql和ROR - Gem::Ext::BuildError: ERROR: Failed to build gem native extension. postgresql and ROR Gem :: Ext :: BuildError:错误:无法构建gem本机扩展。 -塔林杜 - Gem::Ext::BuildError: ERROR: Failed to build gem native extension. - tharindu Gem :: Ext :: BuildError:错误:无法构建gem原生扩展。 - CentOS 6.5 - Gem::Ext::BuildError: ERROR: Failed to build gem native extension. - CentOS 6.5 Rails:Gem :: Ext :: BuildError:错误:无法构建gem本机扩展 - Rails: Gem::Ext::BuildError: ERROR: Failed to build gem native extension Gem :: Ext :: BuildError:错误:无法构建gem本机扩展Mavericks - Gem::Ext::BuildError: ERROR: Failed to build gem native extension Mavericks Gem:Ext::BuildError: ERROR: Failed to build gem native extension on Mac - Gem:Ext::BuildError: ERROR: Failed to build gem native extension on Mac
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM