Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/55.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何安装mysql2?_Mysql_Ruby On Rails_Ruby_Windows_Mysql2 - Fatal编程技术网

如何安装mysql2?

如何安装mysql2?,mysql,ruby-on-rails,ruby,windows,mysql2,Mysql,Ruby On Rails,Ruby,Windows,Mysql2,我是rails开发的新手,在过去的一个月里一直在努力安装mysql2。我有windows 8.1 64位、ruby 2.0.0p535 64位、rails 4.0.2,还有mysql2(0.3.14)64位。我从cmd得到的错误如下 C:\Users\tghol_000>gem install mysql2 --platform=ruby -- '--with-mysql-dir="C:\mysql-connector\"' --with-mysql lib="C:\mysql-

我是rails开发的新手,在过去的一个月里一直在努力安装mysql2。我有windows 8.1 64位、ruby 2.0.0p535 64位、rails 4.0.2,还有mysql2(0.3.14)64位。我从cmd得到的错误如下

C:\Users\tghol_000>gem install mysql2 --platform=ruby -- '--with-mysql-dir="C:\mysql-connector\"' --with-mysql lib="C:\mysql-connector\lib"' Temporarily enhancing PATH to include DevKit... Building native extensions with: '--with-mysql-dir="C:\mysql-connector\" --with-mysql-lib=C:\mysql- connector\lib' This could take a while... *** 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-x64/bin/ruby --with-mysql-dir --with-mysql-include --without-mysql-include=${mysql-dir}/include --with-mysql-lib --without-mysql-lib=${mysql-dir}/ --with-mysql-dir --with-mysql-include --without-mysql-include=${mysql-dir}/include --with-mysql-lib --without-mysql-lib=${mysql-dir}/lib C:/Ruby200-x64/lib/ruby/2.0.0/shellwords.rb:75:in `block in shellsplit': Unmatched double quote: "\"-IC:\\mysql-connector\" --with-mysql-lib=C:\\mysql-connector\\lib 2>&1/include\" -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 $(DEFS) $(cppflags)" (ArgumentError) from C:/Ruby200-x64/lib/ruby/2.0.0/shellwords.rb:73:in `scan' from C:/Ruby200-x64/lib/ruby/2.0.0/shellwords.rb:73:in `shellsplit' from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:1687:in `dir_config' from extconf.rb:42:in `' ERROR: Error installing mysql2: ERROR: Failed to build gem native extension. C:/Ruby200-x64/bin/ruby.exe extconf.rb --with-mysql-dir="C:\mysql-connector\" --with- mysql-lib=C:\mysql-connector\lib checking for ruby/thread.h... yes checking for rb_thread_call_without_gvl() checking for rb_thread_blocking_region()... yes checking for rb_wait_for_single_fd()... yes checking for rb_hash_dup()... yes checking for rb_intern3()... yes extconf failed, exit code 1 Gem files will remain installed in C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.14 for inspection. Results logged to C:/Ruby200-x64/lib/ruby/gems/2.0.0/extensions/x64-mingw32/2.0.0/mysql2-0.3.14/gem_make.out C:\Users\tghol\u 000>gem安装mysql2--platform=ruby--'--使用mysql dir=“C:\mysql connector\”--使用mysql lib=“C:\mysql connector\lib”' 暂时增强包含DevKit的路径。。。 使用“--with mysql dir=“C:\mysql connector\”--with mysql lib=C:\mysql-connector\lib”构建本机扩展 这可能需要一段时间。。。 ***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:/Ruby200-x64/bin/ruby --使用mysql目录 --使用mysql包括 --不带mysql include=${mysql dir}/include --使用mysql库 --没有mysql lib=${mysql dir}/ --使用mysql目录 --使用mysql包括 --不带mysql include=${mysql dir}/include --使用mysql库 --没有mysql-lib=${mysql-dir}/lib C:/Ruby200-x64/lib/ruby/2.0.0/shellwords.rb:75:in`block in shellsplit':不匹配的双引号:“\”-IC:\\mysql connector\”--with mysql lib=C:\\mysql connector\\lib 2>&1/include\“-DFD\u SETSIZE=2048-D\u WIN32\u WINNT=0x0501$(DEFS)$(cppflags)” (错误) 来自C:/Ruby200-x64/lib/ruby/2.0.0/shellwords.rb:73:in'scan' from C:/Ruby200-x64/lib/ruby/2.0.0/shellwords.rb:73:in'shellsplit' 来自C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:1687:in'dir_config' 来自extconf.rb:42:in`' 错误:安装mysql2时出错: 错误:无法生成gem本机扩展。 C:/Ruby200-x64/bin/ruby.exe extconf.rb——with mysql dir=“C:\mysql connector\”——with-mysql lib=C:\mysql connector\lib 正在检查ruby/thread.h…是 检查rb_线程_调用_而不检查_gvl() 正在检查rb_线程_阻塞_区域()…是 正在检查rb\u等待\u单个\u fd()…是 正在检查rb_hash_dup()…是 正在检查rb_intern3()…是 extconf失败,退出代码1 Gem文件将保持安装在C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.14中以供检查。 结果记录到C:/Ruby200-x64/lib/ruby/gems/2.0.0/extensions/x64-mingw32/2.0.0/mysql2-0.3.14/gem_make.out mkmf.log

have_header: checking for ruby/thread.h... -------------------- yes

"x86_64-w64-mingw32-gcc -o conftest.exe -IC:/Ruby200-x64/include/ruby-2.0.0/x64-mingw32 -IC:/Ruby200-x64/include/ruby-2.0.0/ruby/backward -IC:/Ruby200-x64/include/ruby-2.0.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D_FILE_OFFSET_BITS=64   -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c  -L. -LC:/Ruby200-x64/lib -L.      -lx64-msvcrt-ruby200  -lshell32 -lws2_32 -limagehlp -lshlwapi  "
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <winsock2.h>
4: #include <windows.h>
5: int main(int argc, char **argv)
6: {
7:   return 0;
8: }
/* end */

"x86_64-w64-mingw32-gcc -E -IC:/Ruby200-x64/include/ruby-2.0.0/x64-mingw32 -IC:/Ruby200-x64/include/ruby-2.0.0/ruby/backward -IC:/Ruby200-x64/include/ruby-2.0.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D_FILE_OFFSET_BITS=64   -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration  conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <winsock2.h>
4: #include <windows.h>
5: #include <ruby/thread.h>
/* end */

--------------------

have_func: checking for rb_thread_call_without_gvl() in ruby/thread.h... -------------------- yes

"x86_64-w64-mingw32-gcc -o conftest.exe -IC:/Ruby200-x64/include/ruby-2.0.0/x64-mingw32 -IC:/Ruby200-x64/include/ruby-2.0.0/ruby/backward -IC:/Ruby200-x64/include/ruby-2.0.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D_FILE_OFFSET_BITS=64   -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c  -L. -LC:/Ruby200-x64/lib -L.      -lx64-msvcrt-ruby200  -lshell32 -lws2_32 -limagehlp -lshlwapi  "
conftest.c: In function 't':
conftest.c:9:32: warning: variable 'p' set but not used [-Wunused-but-set-variable]
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <winsock2.h>
 4: #include <windows.h>
 5: #include <ruby/thread.h>
 6: 
 7: /*top*/
 8: extern int t(void);
 9: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_thread_call_without_gvl; return 0; }
10: int main(int argc, char **argv)
11: {
12:   if (argc > 1000000) {
13:     printf("%p", &t);
14:   }
15: 
16:   return 0;
17: }
/* end */

--------------------

have_func: checking for rb_thread_blocking_region()... -------------------- yes

"x86_64-w64-mingw32-gcc -o conftest.exe -IC:/Ruby200-x64/include/ruby-2.0.0/x64-mingw32 -IC:/Ruby200-x64/include/ruby-2.0.0/ruby/backward -IC:/Ruby200-x64/include/ruby-2.0.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D_FILE_OFFSET_BITS=64   -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c  -L. -LC:/Ruby200-x64/lib -L.      -lx64-msvcrt-ruby200  -lshell32 -lws2_32 -limagehlp -lshlwapi  "
conftest.c: In function 't':
conftest.c:8:1: warning: 'rb_thread_blocking_region' is deprecated (declared at C:/Ruby200-x64/include/ruby-2.0.0/ruby/intern.h:841) [-Wdeprecated-declarations]
conftest.c:8:32: warning: variable 'p' set but not used [-Wunused-but-set-variable]
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <winsock2.h>
 4: #include <windows.h>
 5: 
 6: /*top*/
 7: extern int t(void);
 8: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_thread_blocking_region; return 0; }
 9: int main(int argc, char **argv)
10: {
11:   if (argc > 1000000) {
12:     printf("%p", &t);
13:   }
14: 
15:   return 0;
16: }
/* end */

--------------------

have_func: checking for rb_wait_for_single_fd()... -------------------- yes

"x86_64-w64-mingw32-gcc -o conftest.exe -IC:/Ruby200-x64/include/ruby-2.0.0/x64-mingw32 -IC:/Ruby200-x64/include/ruby-2.0.0/ruby/backward -IC:/Ruby200-x64/include/ruby-2.0.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D_FILE_OFFSET_BITS=64   -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c  -L. -LC:/Ruby200-x64/lib -L.      -lx64-msvcrt-ruby200  -lshell32 -lws2_32 -limagehlp -lshlwapi  "
conftest.c: In function 't':
conftest.c:8:57: error: 'rb_wait_for_single_fd' undeclared (first use in this function)
conftest.c:8:57: note: each undeclared identifier is reported only once for each function it appears in
conftest.c:8:32: warning: variable 'p' set but not used [-Wunused-but-set-variable]
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <winsock2.h>
 4: #include <windows.h>
 5: 
 6: /*top*/
 7: extern int t(void);
 8: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_wait_for_single_fd; return 0; }
 9: int main(int argc, char **argv)
10: {
11:   if (argc > 1000000) {
12:     printf("%p", &t);
13:   }
14: 
15:   return 0;
16: }
/* end */

"x86_64-w64-mingw32-gcc -o conftest.exe -IC:/Ruby200-x64/include/ruby-2.0.0/x64-mingw32 -IC:/Ruby200-x64/include/ruby-2.0.0/ruby/backward -IC:/Ruby200-x64/include/ruby-2.0.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D_FILE_OFFSET_BITS=64   -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c  -L. -LC:/Ruby200-x64/lib -L.      -lx64-msvcrt-ruby200  -lshell32 -lws2_32 -limagehlp -lshlwapi  "
conftest.c: In function 't':
conftest.c:8:1: warning: implicit declaration of function 'rb_wait_for_single_fd' [-Wimplicit-function-declaration]
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <winsock2.h>
 4: #include <windows.h>
 5: 
 6: /*top*/
 7: extern int t(void);
 8: int t(void) { rb_wait_for_single_fd(); return 0; }
 9: int main(int argc, char **argv)
10: {
11:   if (argc > 1000000) {
12:     printf("%p", &t);
13:   }
14: 
15:   return 0;
16: }
/* end */

--------------------

have_func: checking for rb_hash_dup()... -------------------- yes

"x86_64-w64-mingw32-gcc -o conftest.exe -IC:/Ruby200-x64/include/ruby-2.0.0/x64-mingw32 -IC:/Ruby200-x64/include/ruby-2.0.0/ruby/backward -IC:/Ruby200-x64/include/ruby-2.0.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D_FILE_OFFSET_BITS=64   -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c  -L. -LC:/Ruby200-x64/lib -L.      -lx64-msvcrt-ruby200  -lshell32 -lws2_32 -limagehlp -lshlwapi  "
conftest.c: In function 't':
conftest.c:8:32: warning: variable 'p' set but not used [-Wunused-but-set-variable]
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <winsock2.h>
 4: #include <windows.h>
 5: 
 6: /*top*/
 7: extern int t(void);
 8: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_hash_dup; return 0; }
 9: int main(int argc, char **argv)
10: {
11:   if (argc > 1000000) {
12:     printf("%p", &t);
13:   }
14: 
15:   return 0;
16: }
/* end */

--------------------

have_func: checking for rb_intern3()... -------------------- yes

"x86_64-w64-mingw32-gcc -o conftest.exe -IC:/Ruby200-x64/include/ruby-2.0.0/x64-mingw32 -IC:/Ruby200-x64/include/ruby-2.0.0/ruby/backward -IC:/Ruby200-x64/include/ruby-2.0.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D_FILE_OFFSET_BITS=64   -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c  -L. -LC:/Ruby200-x64/lib -L.      -lx64-msvcrt-ruby200  -lshell32 -lws2_32 -limagehlp -lshlwapi  "
conftest.c: In function 't':
conftest.c:8:57: error: 'rb_intern3' undeclared (first use in this function)
conftest.c:8:57: note: each undeclared identifier is reported only once for each function it appears in
conftest.c:8:32: warning: variable 'p' set but not used [-Wunused-but-set-variable]
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <winsock2.h>
 4: #include <windows.h>
 5: 
 6: /*top*/
 7: extern int t(void);
 8: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_intern3; return 0; }
 9: int main(int argc, char **argv)
10: {
11:   if (argc > 1000000) {
12:     printf("%p", &t);
13:   }
14: 
15:   return 0;
16: }
/* end */

"x86_64-w64-mingw32-gcc -o conftest.exe -IC:/Ruby200-x64/include/ruby-2.0.0/x64-mingw32 -IC:/Ruby200-x64/include/ruby-2.0.0/ruby/backward -IC:/Ruby200-x64/include/ruby-2.0.0 -I. -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D_FILE_OFFSET_BITS=64   -O3 -fno-omit-frame-pointer -fno-fast-math -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c  -L. -LC:/Ruby200-x64/lib -L.      -lx64-msvcrt-ruby200  -lshell32 -lws2_32 -limagehlp -lshlwapi  "
conftest.c: In function 't':
conftest.c:8:1: warning: implicit declaration of function 'rb_intern3' [-Wimplicit-function-declaration]
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <winsock2.h>
 4: #include <windows.h>
 5: 
 6: /*top*/
 7: extern int t(void);
 8: int t(void) { rb_intern3(); return 0; }
 9: int main(int argc, char **argv)
10: {
11:   if (argc > 1000000) {
12:     printf("%p", &t);
13:   }
14: 
15:   return 0;
16: }
/* end */

--------------------
have_头:检查ruby/thread.h..----是
"x86_64-w64-mingw32-gcc-o conftest.exe-IC:/Ruby200-x64/include/ruby-2.0.0/x64-mingw32-IC:/Ruby200-x64/include/ruby-2.0.0/ruby/backward-IC:/Ruby200-x64/include/ruby-2.0.0-I.-DFD_SETSIZE=2048-d32_WINNT=0x0501-D_FILE_OFFSET_BITS=64-O3-fno省略帧指针-fno快速数学-g-Wall-Wextra-Wno参数-Wno long long-Wno缺少字段初始值设定项-Wunused变量-Wpointer arith-Wwrite strings-Wdeclaration after语句-Wimplicit函数声明conftest.c-L-LC:/Ruby200-x64/lib-L-lx64-msvcrt-Ruby200-lshell32-lws2_32-limagehlp-lshlwapi“
检查的程序是:
/*开始*/
1:#包括“ruby.h”
2: 
3:#包括
4:#包括
5:int main(int argc,字符**argv)
6: {
7:返回0;
8: }
/*结束*/
"x86_64-w64-mingw32-gcc-E-IC:/Ruby200-x64/include/ruby-2.0.0/x64-mingw32-IC:/Ruby200-x64/include/ruby-2.0.0/ruby/backward-IC:/Ruby200-x64/include/ruby-2.0.0-I.-DFD_SETSIZE=2048-D_WIN32\u WINNT=0x0501-D_FILE\u OFFSET\u BITS=64-O3-fno帧指针-fno快速-g-Wall-xtra-Wno-Wno未使用的长括号-Wno缺少字段初始值设定项-Wunused变量-Wpointer arith-Wwrite strings-WdeClation after语句-Wimplicit函数声明conftest.c-o conftest.i“
检查的程序是:
/*开始*/
1:#包括“ruby.h”
2: 
3:#包括
4:#包括
5:#包括
/*结束*/
--------------------
have_func:在ruby/thread.h中检查rb_线程调用,但不检查\u gvl()。----------------是
"x86_64-w64-mingw32-gcc-o conftest.exe-IC:/Ruby200-x64/include/ruby-2.0.0/x64-mingw32-IC:/Ruby200-x64/include/ruby-2.0.0/ruby/backward-IC:/Ruby200-x64/include/ruby-2.0.0-I.-DFD_SETSIZE=2048-d32_WINNT=0x0501-D_FILE_OFFSET_BITS=64-O3-fno省略帧指针-fno快速数学-g-Wall-Wextra-Wno参数-Wno long long-Wno缺少字段初始值设定项-Wunused变量-Wpointer arith-Wwrite strings-Wdeclaration after语句-Wimplicit函数声明conftest.c-L-LC:/Ruby200-x64/lib-L-lx64-msvcrt-Ruby200-lshell32-lws2_32-limagehlp-lshlwapi“
conftest.c:在函数“t”中:
conftest.c:9:32:警告:变量“p”已设置但未使用[-Wunused但已设置变量]
检查的程序是:
/*开始*/
1:#包括“ruby.h”
2: 
3:#包括
4:#包括
5:#包括
6: 
7:/*顶部*/
8:外部内部t(无效);
9:int t(void){void((*volatile p)();p=(void(*)())rb_线程调用_而不调用_gvl;返回0;}
10:int main(int argc,字符**argv)
11: {
12:如果(argc>1000000){
13:printf(“%p”和“t”);
14:   }
15: 
16:返回0;
17: }
/*结束*/
--------------------
have_func:正在检查rb_线程\u阻塞\u区域()…--------------是
"x86_64-w64-mingw32-gcc-o conftest.exe-IC:/Ruby200-x64/include/ruby-2.0.0/x64-mingw32-IC:/Ruby200-x64/include/ruby-2.0.0/ruby/backward-IC:/Ruby200-x64/include/ruby-2.0.0-I.-DFD_SETSIZE=2048-d32_WINNT=0x0501-D_FILE_OFFSET_BITS=64-O3-fno省略帧指针-fno快速数学-g-Wall-Wextra-Wno参数-卢文龙
C:\Users\tghol_000>gem install mysql2 --platform=ruby -- '--with-mysql-dir="C:\mysql-connector\"' --with-mysql         lib="C:\mysql-connector\lib"'
                                                                                                ^-- remove that '