【问题标题】:yosemite gem install fail优胜美地宝石安装失败
【发布时间】:2014-12-09 05:56:03
【问题描述】:

升级到 yosemite 后无法运行 bundle install,mkmf.log 内容如下

/usr/local/opt/gcc46/bin/gcc-4.6 -o conftest -I/Users/mac/.rvm/rubies/ruby-1.9.3-p547/include/ruby-1.9.1/x86_64-darwin12.4.0 -I/Users/mac/.rvm/rubies/ruby-1.9.3-p547/include/ruby-1.9.1/ruby/backward -I/Users/mac/.rvm/rubies/ruby-1.9.3-p547/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -fno-common -pipe conftest.c -L. -L/Users/mac/.rvm/rubies/ruby-1.9.3-p547/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -L. -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -lruby.1.9.1 -lpthread -ldl -lobjc

它似乎正在尝试使用 gcc-4.6,但是当我执行 gcc -v 时,它给了我这个

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn) Target: x86_64-apple-darwin14.0.0 Thread model: posix

我也尝试用 ln -s 链接/usr/local/opt/gcc46/bin/gcc-4.6,但没有任何帮助,我不断收到

/Users/mac/.rvm/rubies/ruby-1.9.3-p547/bin/ruby extconf.rb checking if the C compiler accepts ... *** 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..

任何帮助将不胜感激

【问题讨论】:

  • 您尝试安装什么 gem?你在更新到优胜美地之前安装了 ruby​​ 吗?
  • 安装 nokogiri 时捆绑包失败,是的,我之前在山狮的轨道上使用 ruby​​,然后我升级到优胜美地

标签: ruby-on-rails macos gcc gem


【解决方案1】:

尝试重新安装 ruby​​:

rvm get stable
rvm reinstall 1.9.3-p547

然后bundle install

【讨论】:

  • 在这样做的时候得到了这个checking whether the C compiler works... noconfigure: error: in /Users/mac/.rvm/src/ruby-1.9.3-p547':`configure: error: C compiler cannot create executables
  • 我想我同时使用这两个是因为我已经安装了 xcode 并且我还从苹果下载并安装了命令行工具
  • 你试过xcode-select --install 吗?如果它没有帮助,那么我不知道如何解决它
  • 是的,我做了,但安装后没有帮助,不过感谢您的帮助
【解决方案2】:

我遇到了同样的问题 - 结果是,我不得不在最新版本中重新安装 ruby​​ 并以原始方式构建所有 gem。

http://danielpuglisi.com/articles/2014/10/reinstall-ruby-after-upgrading-to-osx-yosemite

这个解决方案效果很好,我删除了 rbenv 中列出的所有旧版本,然后按照链接中的说明安装了 ruby​​ 2.1.3,然后使用 gem pristine --all,我很高兴,不再出现烦人的错误消息。

这些步骤实际上取决于您使用的是哪个,rbenv 或 rmv。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多