在Windows上安装mysql2 gem for ruby 2.0.0时出错

在Windows上安装mysql2 gem for ruby 2.0.0时出错,mysql,ruby-on-rails,ruby,compilation,gem,Mysql,Ruby On Rails,Ruby,Compilation,Gem,我正在尝试为Ruby 2.0.0安装mysql2gem 我试着按照当时的指示去做,但没有成功。鉴于下面的错误消息,有人能帮我解决此错误吗 Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... ERROR: Error installing mysql2: ERROR: Failed to build gem native ex

我正在尝试为Ruby 2.0.0安装
mysql2
gem

我试着按照当时的指示去做,但没有成功。鉴于下面的错误消息,有人能帮我解决此错误吗

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

        C:/xampp/Ruby200-x64ruby.exe extconf.rb
checking for rb_thread_blocking_region()... yes
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:/xampp/Ruby200-x64ruby
        --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-libmysqllib
        --without-libmysqllib


Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql2-0.
3.6 for inspection.
Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql2-0.3.6/ext/mysql2/ge
m_make.out
我的ruby是从这里下载的:

编辑

C:\xampp\Ruby200-x64\lib\ruby\gems\2.0.0>gem安装mysql2----使用mysql lib
=“c:\xampp\mysql\lib”--with mysql include=“c:\xampp\mysql\include”--with mysql
-config=“c:/xampp/mysql/bin/mysql\u config.exe”'
暂时增强包含DevKit的路径。。。
使用“--with-mysql-lib=“c:\xampp\mysql\lib”--with-m构建本机扩展
ysql include=“c:\xampp\mysql\include”--带有mysql config=“c:/xampp/mysql/bin/my
sql_config.exe“'
这可能需要一段时间。。。
错误:安装mysql2时出错:
错误:无法生成gem本机扩展。
C:/xampp/Ruby200-x64/bin/ruby.exe extconf.rb——使用mysql lib=“C:\xampp\mysq
l\lib”--带有mysql include=“c:\xampp\mysql\include”--带有mysql config=“c:/xam
pp/mysql/bin/mysql\u config.exe“

正在检查rb_线程_阻塞_区域()…***extconf.rb失败*** 由于某些原因无法创建Makefile,可能缺少必要的 库和/或标题。有关详细信息,请查看mkmf.log文件。你可以 需要配置选项。 提供的配置选项: --使用opt dir --不带opt dir --选择包含 --不带opt include=${opt dir}/include --使用opt lib --不带opt lib=${opt dir}/lib --用make prog --没有make prog --srcdir=。 --库尔迪尔 --ruby=C:/xampp/Ruby200-x64/bin/ruby C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:431:“尝试”:编译器失败 生成可执行文件。(运行时错误) 您必须首先安装开发工具。 来自C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:516:in'try_link0' 来自C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:531:in'try_link' 来自C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:717:in'try_func' 来自C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:1001:in`block in have_ func' 来自C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:892:in`block in checki 伍兹 来自C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:337:in`block(两个级别 )推迟 from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:307:in'open' 来自C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:337:in`block in postpo ne' from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:307:in'open' from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:333:in“推迟” 来自C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:891:in“checking_for” 来自C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:1000:in'have_func' 来自extconf.rb:9:in`' Gem文件仍将安装在C:/xampp/Ruby200-x64/lib/ruby/gems/2.0.0/gems中 /mysql2-0.3.11进行检查。 结果记录到C:/xampp/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11/ex t/mysql2/gem\u make.out C:\xampp\Ruby200-x64\lib\ruby\gems\2.0.0>gem使用mysql库安装mysql2-- =“c:/xampp/mysql/lib”--带mysql include=“c:/xampp/mysql/include”--带mysql -config=“c:/xampp/mysql/bin/mysql\u config.exe”' 暂时增强包含DevKit的路径。。。 使用“--with-mysql-lib=“c:/xampp/mysql/lib”--with-m构建本机扩展 ysql include=“c:/xampp/mysql/include”--带有mysql config=“c:/xampp/mysql/bin/my sql_config.exe“' 这可能需要一段时间。。。 错误:安装mysql2时出错: 错误:无法生成gem本机扩展。 C:/xampp/Ruby200-x64/bin/ruby.exe extconf.rb——使用mysql lib=“C:/xampp/mysq l/lib”--带有mysql include=“c:/xampp/mysql/include”--带有mysql config=“c:/xam pp/mysql/bin/mysql\u config.exe“
正在检查rb_线程_阻塞_区域()…***extconf.rb失败*** 由于某些原因无法创建Makefile,可能缺少必要的 库和/或标题。有关详细信息,请查看mkmf.log文件。你可以 需要配置选项。 提供的配置选项: --使用opt dir --不带opt dir --选择包含 --不带opt include=${opt dir}/include --使用opt lib --不带opt lib=${opt dir}/lib --用make prog --没有make prog --srcdir=。 --库尔迪尔 --ruby=C:/xampp/Ruby200-x64/bin/ruby C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:431:“尝试”:编译器失败 生成可执行文件。(运行时错误) 您必须首先安装开发工具。 来自C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:516:in'try_link0' 来自C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:531:in'try_link' 来自C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:717:in'try_func' 来自C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:1001:in`block in have_ func' 来自C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:892:in`block in checki 伍兹 来自C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:337:in`block(两个级别 )推迟 from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:307:in'open' 来自C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:337:in`block in postpo ne' from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:307:in'open' from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:333:in“推迟” 来自C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:891:in“checking_for” 来自C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:1000:in'have_func' 来自extconf.rb:9:in`' Gem文件仍将安装在C:/xampp/Ruby200-x64/lib/ruby/gems/2.0.0/gems中 /mysql2-0.3.11进行检查。 结果记录到C:/xampp/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11/ex t/mysql2/gem\u make.out C:\xampp\Ruby200-x64\lib\ruby\gems\2.0.0>gem安装mysql--'--使用mysql库= “c:/xampp/mysql/lib”--带mysql include=“c:/xampp/mysql/include”--带mysql- config=“c:/xampp/mysql/bin/mysql_
C:\xampp\Ruby200-x64\lib\ruby\gems\2.0.0>gem install mysql2 -- '--with-mysql-lib
="c:\xampp\mysql\lib" --with-mysql-include="c:\xampp\mysql\include" --with-mysql
-config="c:/xampp/mysql/bin/mysql_config.exe"'
Temporarily enhancing PATH to include DevKit...
Building native extensions with: '--with-mysql-lib="c:\xampp\mysql\lib" --with-m
ysql-include="c:\xampp\mysql\include" --with-mysql-config="c:/xampp/mysql/bin/my
sql_config.exe"'
This could take a while...
ERROR:  Error installing mysql2:
        ERROR: Failed to build gem native extension.

    C:/xampp/Ruby200-x64/bin/ruby.exe extconf.rb --with-mysql-lib="c:\xampp\mysq
l\lib" --with-mysql-include="c:\xampp\mysql\include" --with-mysql-config="c:/xam
pp/mysql/bin/mysql_config.exe"
checking for rb_thread_blocking_region()... *** 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:/xampp/Ruby200-x64/bin/ruby
C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:431:in `try_do': The compiler failed
 to generate an executable file. (RuntimeError)
You have to install development tools first.
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:516:in `try_link0'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:531:in `try_link'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:717:in `try_func'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:1001:in `block in have_
func'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:892:in `block in checki
ng_for'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:337:in `block (2 levels
) in postpone'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:307:in `open'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:337:in `block in postpo
ne'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:307:in `open'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:333:in `postpone'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:891:in `checking_for'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:1000:in `have_func'
        from extconf.rb:9:in `<main>'


Gem files will remain installed in C:/xampp/Ruby200-x64/lib/ruby/gems/2.0.0/gems
/mysql2-0.3.11 for inspection.
Results logged to C:/xampp/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11/ex
t/mysql2/gem_make.out

C:\xampp\Ruby200-x64\lib\ruby\gems\2.0.0>gem install mysql2 -- '--with-mysql-lib
="c:/xampp/mysql/lib" --with-mysql-include="c:/xampp/mysql/include" --with-mysql
-config="c:/xampp/mysql/bin/mysql_config.exe"'
Temporarily enhancing PATH to include DevKit...
Building native extensions with: '--with-mysql-lib="c:/xampp/mysql/lib" --with-m
ysql-include="c:/xampp/mysql/include" --with-mysql-config="c:/xampp/mysql/bin/my
sql_config.exe"'
This could take a while...
ERROR:  Error installing mysql2:
        ERROR: Failed to build gem native extension.

    C:/xampp/Ruby200-x64/bin/ruby.exe extconf.rb --with-mysql-lib="c:/xampp/mysq
l/lib" --with-mysql-include="c:/xampp/mysql/include" --with-mysql-config="c:/xam
pp/mysql/bin/mysql_config.exe"
checking for rb_thread_blocking_region()... *** 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:/xampp/Ruby200-x64/bin/ruby
C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:431:in `try_do': The compiler failed
 to generate an executable file. (RuntimeError)
You have to install development tools first.
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:516:in `try_link0'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:531:in `try_link'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:717:in `try_func'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:1001:in `block in have_
func'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:892:in `block in checki
ng_for'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:337:in `block (2 levels
) in postpone'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:307:in `open'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:337:in `block in postpo
ne'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:307:in `open'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:333:in `postpone'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:891:in `checking_for'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:1000:in `have_func'
        from extconf.rb:9:in `<main>'


Gem files will remain installed in C:/xampp/Ruby200-x64/lib/ruby/gems/2.0.0/gems
/mysql2-0.3.11 for inspection.
Results logged to C:/xampp/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.11/ex
t/mysql2/gem_make.out

C:\xampp\Ruby200-x64\lib\ruby\gems\2.0.0>gem install mysql -- '--with-mysql-lib=
"c:/xampp/mysql/lib" --with-mysql-include="c:/xampp/mysql/include" --with-mysql-
config="c:/xampp/mysql/bin/mysql_config.exe"'
Fetching: mysql-2.9.1.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions with: '--with-mysql-lib="c:/xampp/mysql/lib" --with-m
ysql-include="c:/xampp/mysql/include" --with-mysql-config="c:/xampp/mysql/bin/my
sql_config.exe"'
This could take a while...
ERROR:  Error installing mysql:
        ERROR: Failed to build gem native extension.

    C:/xampp/Ruby200-x64/bin/ruby.exe extconf.rb --with-mysql-lib="c:/xampp/mysq
l/lib" --with-mysql-include="c:/xampp/mysql/include" --with-mysql-config="c:/xam
pp/mysql/bin/mysql_config.exe"
checking for main() in -llibmysql... *** 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:/xampp/Ruby200-x64/bin/ruby
        --with-mysql-dir
        --without-mysql-dir
        --with-mysql-include=${mysql-dir}/include
        --with-mysql-lib=${mysql-dir}/
        --with-libmysqllib
        --without-libmysqllib
C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:431:in `try_do': The compiler failed
 to generate an executable file. (RuntimeError)
You have to install development tools first.
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:516:in `try_link0'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:531:in `try_link'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:717:in `try_func'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:947:in `block in have_l
ibrary'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:892:in `block in checki
ng_for'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:337:in `block (2 levels
) in postpone'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:307:in `open'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:337:in `block in postpo
ne'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:307:in `open'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:333:in `postpone'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:891:in `checking_for'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:942:in `have_library'
        from extconf.rb:27:in `<main>'


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

C:\xampp\Ruby200-x64\lib\ruby\gems\2.0.0>gem install mysql -- '--with-mysql-lib=
"c:/xampp/mysql/lib" --with-mysql-include="c:/xampp/mysql/include" --with-mysql-
config="c:/xampp/mysql/bin/mysql_config"'
Temporarily enhancing PATH to include DevKit...
Building native extensions with: '--with-mysql-lib="c:/xampp/mysql/lib" --with-m
ysql-include="c:/xampp/mysql/include" --with-mysql-config="c:/xampp/mysql/bin/my
sql_config"'
This could take a while...
ERROR:  Error installing mysql:
        ERROR: Failed to build gem native extension.

    C:/xampp/Ruby200-x64/bin/ruby.exe extconf.rb --with-mysql-lib="c:/xampp/mysq
l/lib" --with-mysql-include="c:/xampp/mysql/include" --with-mysql-config="c:/xam
pp/mysql/bin/mysql_config"
checking for main() in -llibmysql... *** 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:/xampp/Ruby200-x64/bin/ruby
        --with-mysql-dir
        --without-mysql-dir
        --with-mysql-include=${mysql-dir}/include
        --with-mysql-lib=${mysql-dir}/
        --with-libmysqllib
        --without-libmysqllib
C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:431:in `try_do': The compiler failed
 to generate an executable file. (RuntimeError)
You have to install development tools first.
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:516:in `try_link0'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:531:in `try_link'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:717:in `try_func'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:947:in `block in have_l
ibrary'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:892:in `block in checki
ng_for'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:337:in `block (2 levels
) in postpone'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:307:in `open'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:337:in `block in postpo
ne'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:307:in `open'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:333:in `postpone'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:891:in `checking_for'
        from C:/xampp/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:942:in `have_library'
        from extconf.rb:27:in `<main>'


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

C:\xampp\Ruby200-x64\lib\ruby\gems\2.0.0>
checking for main() in -llibmysql... no
checking for main() in -llibmysql... yes
checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing.  please check your installation of mysql and try again.
 gem install mysql2 — ‘–with-mysql-lib=”c:\Program Files\MySQL\MySQL Server 5.6\lib” –with-mysql-include=”c:\Program Files\MySQL\MySQL Server 5.6\include”‘