Ошибка установки Mysql2 gem и установка пакета не удалась - PullRequest
0 голосов
/ 24 октября 2019

Я пытаюсь запустить установку пакета. Моя среда - 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.

1 Ответ

0 голосов
/ 24 октября 2019

Первый запуск следующего в терминале,

И предоставление ему следующего,

locate mysql_config

, который обеспечил, /usr/bin/mysql_config

А теперь запуск,

sudo gem install mysql -- --with-mysql-config=/usr/bin/mysql_config
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...