我正在尝试运行捆绑软件安装。我的环境是Mojave,当前的ruby版本安装为2.3.7,由于终端中出现以下错误,我无法进行捆绑安装。谁能让我知道为什么失败了。
我也尝试了捆绑更新。对我没有任何帮助。
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/efutures/Documents/vhosts/Actionrev-average-costing/.bundle/ruby/2.3.0/gems/mysql2-0.4.10/ext/mysql2
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -I /Library/Ruby/Site/2.3.0 -r ./siteconf20191024-23547-w2j56k.rb extconf.rb --with-ldflags\=-L/usr/local/opt/openssl/lib\
--with-cppflags\=-I/usr/local/opt/openssl/include
checking for rb_absint_size()... *** 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
--without-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=/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/$(RUBY_BASE_NAME)
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:535:in `block in try_link0'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/tmpdir.rb:89:in `mktmpdir'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:532:in `try_link0'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:556:in `try_link'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:765:in `try_func'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:1051:in `block in have_func'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:320:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:320:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:346:in `postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:1050:in `have_func'
from extconf.rb:26:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/efutures/Documents/vhosts/Actionrev-average-costing/.bundle/ruby/2.3.0/extensions/universal-darwin-18/2.3.0/mysql2-0.4.10/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/efutures/Documents/vhosts/Actionrev-average-costing/.bundle/ruby/2.3.0/gems/mysql2-0.4.10 for inspection.
Results logged to /Users/efutures/Documents/vhosts/Actionrev-average-costing/.bundle/ruby/2.3.0/extensions/universal-darwin-18/2.3.0/mysql2-0.4.10/gem_make.out
An error occurred while installing mysql2 (0.4.10), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.4.10' --source 'https://rubygems.org/'` succeeds before bundling.
答案 0 :(得分:0)
首先在终端中运行,
并在其后提供
locate mysql_config
其中提供了/usr/bin/mysql_config
现在运行,
sudo gem install mysql -- --with-mysql-config=/usr/bin/mysql_config