【问题标题】:I am trying to install mysql2 gem to navigate db's with ruby and it gave me an error. Windows我正在尝试安装 mysql2 gem 以使用 ruby​​ 导航数据库,但它给了我一个错误。视窗
【发布时间】:2021-05-05 21:40:52
【问题描述】:

我正在尝试安装 mysql2 gem,以便可以结合使用 ruby​​ 和 mysql 浏览 mysql 数据库。我在终端输入:gem install mysql2 - 它做到了:

lr>gem install mysql2
Temporarily enhancing PATH for MSYS/MINGW...
Using msys2 packages: mingw-w64-x86_64-libmariadbclient
Building native extensions. This could take a while...
ERROR:  Error installing mysql2:
        ERROR: Failed to build gem native extension.

    current directory: C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/mysql2-0.5.3/ext/mysql2
C:/Ruby30-x64/bin/ruby.exe -I C:/Ruby30-x64/lib/ruby/3.0.0 -r ./siteconf20210201-7628-g2k8zu.rb extconf.rb
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for rb_wait_for_single_fd()... yes
*** 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=C:/Ruby30-x64/bin/$(RUBY_BASE_NAME)
        --with-mysql-dir
        --without-mysql-dir
        --with-mysql-include
        --without-mysql-include=${mysql-dir}/include
        --with-mysql-lib
        --without-mysql-lib=${mysql-dir}/lib
        --with-mysql-config
        --without-mysql-config
        --with-mysqlclient-dir
        --without-mysqlclient-dir
        --with-mysqlclient-include
        --without-mysqlclient-include=${mysqlclient-dir}/include
        --with-mysqlclient-lib
        --without-mysqlclient-lib=${mysqlclient-dir}/lib
        --with-mysqlclientlib
        --without-mysqlclientlib
C:/Ruby30-x64/lib/ruby/3.0.0/mkmf.rb:1050:in `block in find_library': undefined method `split' for nil:NilClass (NoMethodError)
        from C:/Ruby30-x64/lib/ruby/3.0.0/mkmf.rb:1050:in `collect'
        from C:/Ruby30-x64/lib/ruby/3.0.0/mkmf.rb:1050:in `find_library'
        from extconf.rb:87:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  C:/Ruby30-x64/lib/ruby/gems/3.0.0/extensions/x64-mingw32/3.0.0/mysql2-0.5.3/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/mysql2-0.5.3 for inspection.
Results logged to C:/Ruby30-x64/lib/ruby/gems/3.0.0/extensions/x64-mingw32/3.0.0/mysql2-0.5.3/gem_make.out

如果有人给我一个解决这个问题的方法,这会有所帮助。如果我找到解决方案,我会在这里发布。谢谢!

【问题讨论】:

  • 是的,让 mysql2 在 Windows 上工作是我转向 linux 的主要原因。我现在是一个快乐的人,强烈推荐!

标签: mysql ruby rubygems


【解决方案1】:

您是否已经安装了 MySQL?如果没有先安装,然后重试。你也可以查看这个Installing MySQL2 Gem on Windows

【讨论】:

    猜你喜欢
    • 2019-03-09
    • 1970-01-01
    • 1970-01-01
    • 2011-04-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多