[英]Cannot build gem native extension on El Capitan - fails at lstdc++
I've spent the past hour scouring the internet for any solution to this but so far have come up empty handed... 在过去的一个小时中,我一直在互联网上搜寻有关此问题的任何解决方案,但到目前为止,还是空手而归...
I'm trying to install a gem called taglib-ruby, which has a dependency on a c++ compiler (which one would assume is covered by gcc and Xcode Commandline Tools) and taglib (a C++ library) which I have installed using homebrew. 我正在尝试安装一个名为taglib-ruby的gem,它依赖于我使用自制软件安装的c ++编译器(假定它已被gcc和Xcode命令行工具覆盖)和taglib(C ++库)。 However, it doesn't seem to get as far as trying to include that, because it fails to find lstdc++.
但是,由于无法找到lstdc ++,因此似乎无法做到这一点。
I'm trying to do this on OSX El Capitan (10.11). 我正在OSX El Capitan(10.11)上执行此操作。
Can someone tell me what this dependency is and how I install it? 有人可以告诉我这个依赖是什么以及如何安装吗?
Please see console output below: 请参见下面的控制台输出:
$ gem install taglib-ruby
Building native extensions. This could take a while...
ERROR: Error installing taglib-ruby:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby -r ./siteconf20160618-66149-xswlyl.rb extconf.rb
checking for main() in -lstdc++... *** 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
--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=/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby
--with-tag-dir
--without-tag-dir
--with-tag-include
--without-tag-include=${tag-dir}/include
--with-tag-lib
--without-tag-lib=${tag-dir}/lib
--with-stdc++lib
--without-stdc++lib
/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:461:in `try_link0'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:476:in `try_link'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:619:in `try_func'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:845:in `block in have_library'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:840:in `have_library'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/taglib-ruby-0.7.1/ext/extconf_common.rb:28:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
from extconf.rb:2:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p194/gems/taglib-ruby-0.7.1 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p194/extensions/x86_64-darwin-11/1.9.1/taglib-ruby-0.7.1/gem_make.out
The error message has this in it: 错误消息中包含以下内容:
/usr/local/rvm/rubies/ruby-1.9.3-p194/
That's a pretty old version of ruby. 那是红宝石的旧版本。 Use rvm to install a recent version of ruby:
使用rvm安装最新版本的ruby:
$ rvm install 2.3.1
then try installing the gem again. 然后尝试再次安装gem。
If you want to make that version of ruby the default when you open Terminal: 如果要在打开终端时将该版本的Ruby设置为默认版本:
$ rvm --default use 2.3.1
Edit: Hmmm...on OSX 10.10.5, I was able to do $ brew install taglib
and then successfully install the gem $ gem install taglib-ruby
on both ruby-1.9.3-p194 and ruby-2.3.0. 编辑:嗯...在OSX 10.10.5上,我能够执行
$ brew install taglib
,然后在ruby-1.9.3-p194和ruby-2.3.0上成功安装gem $ gem install taglib-ruby
。 I have the full Xcode installed(Xcode 7.2.1). 我已经安装了完整的Xcode(Xcode 7.2.1)。 I wonder if your Xcode command line tools are as severely outdated as your ruby version?
我想知道您的Xcode命令行工具是否与ruby版本一样严重过时? You can try:
你可以试试:
$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
to get the version of your Xcode command line tools. 获取Xcode命令行工具的版本。
You might need to update rvm, ruby, homebrew, and the Xcode command line tools. 您可能需要更新rvm,ruby,homebrew和Xcode命令行工具。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.