mysql - 无法安装 gem install mysql2 Ruby WINx64

标签 mysql ruby rubygems installation extconf.rb

我一直在寻找这个错误,重新安装一切,并尝试了一切。我在这里找到的都是旧帖子和旧版本。 是的,我已经下载了 MySQL C 连接器并将库移动到那个 ruby​​ 目录。还是什么都没有。

我正在运行 PC WINx64 ruby 版本 2.0.0-p195 最新版本的 DevKit

**gem install mysql2**
**Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
        ERROR: Failed to build gem native extension.

    C:/Ruby200/bin/ruby.exe extconf.rb
checking for main() in -llibmysql... no
*** 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:/Ruby200/bin/ruby
        --with-mysql-dir
        --without-mysql-dir
        --with-mysql-include
        --without-mysql-include=${mysql-dir}/include
        --with-mysql-lib
        --without-mysql-lib=${mysql-dir}/
        --with-libmysqllib
        --without-libmysqllib


Gem files will remain installed in C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql-2.9.1 for inspection.
Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql-2.9.1/ext/mysql_api/gem_make.out**

B:\ROR\hcv>

Windows 总是给我带来麻烦。但这就是我在工作中的全部。谢谢你们。

最佳答案

我已经从 http://dev.mysql.com/downloads/mirror.php?id=412857 下载了连接器

在命令提示符下输入

gem install mysql --platform=ruby -- --with-mysql-include=C:\mysql-connector-c-6.1.0-winx64\include --with-mysql-lib=C:\mysql-connector-c-6.1.0-winx64\lib

关于mysql - 无法安装 gem install mysql2 Ruby WINx64,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16901125/

相关文章:

mysql - 比较两个近似相等的数

php - 用php插入mysql数据库

ruby/regex 获取每个单词的第一个字母

ruby-on-rails - 为什么这个 gem 没有向 Rails 应用程序添加 rake 任务?

php - 在 mysql 数据库中使用 pdo 保存复选框值

MySQL WHERE 时间戳 >= SUBDATE(MAX(时间戳), INTERVAL 5 DAY)

Ruby 的 narray gem 在 Windows 上安装错误

ruby - 使用 watir 连接到本地主机时出现问题

Ruby 1.8.6 `gem install` 段错误与 "abort trap 6"

mysql - 无法在 MacOS Sierra 上安装 "mysql gem"