Mysql2 Gem 安装出现错误。 (Windows 7)
我正在努力安装 mysql2 gem 0.2.7,这是我得到的输出:
C:/RailsInstaller/Ruby192/bin/ruby.exe extconf.rb --with-mysql-dir=X: --with-mysql-lib=X:\lib
--no-rdoc --no-ri
checking for rb_thread_blocking_region()... yes
checking for main() in -llibmysql... yes
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
creating Makefile
make
gcc -I. -IC:/RailsInstaller/Ruby192/include/ruby-1.9.1/i386-mingw32 -I/C/RailsInstaller/Ruby192/include/ruby-1.9.1/ruby/backward -I/C/RailsInstaller/Ruby192/include/ruby-1.9.1 -I. -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -IX:/include -O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -Wall -funroll-loops -o client.o -c client.c
client.c: In function 'rb_mysql_client_query':
client.c:361:11: warning: unused variable 'r'
gcc -I. -IC:/RailsInstaller/Ruby192/include/ruby-1.9.1/i386-mingw32 -I/C/RailsInstaller/Ruby192/include/ruby-1.9.1/ruby/backward -I/C/RailsInstaller/Ruby192/include/ruby-1.9.1 -I. -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -IX:/include -O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -Wall -funroll-loops -o mysql2_ext.o -c mysql2_ext.c
gcc -I. -IC:/RailsInstaller/Ruby192/include/ruby-1.9.1/i386-mingw32 -I/C/RailsInstaller/Ruby192/include/ruby-1.9.1/ruby/backward -I/C/RailsInstaller/Ruby192/include/ruby-1.9.1 -I. -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -IX:/include -O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -Wall -funroll-loops -o result.o -c result.c
result.c: In function 'rb_mysql_result_fetch_fields':
result.c:318:35: warning: comparison between signed and unsigned integer expressions
gcc -shared -s -o mysql2.so client.o mysql2_ext.o result.o -L. -LC:/RailsInstaller/Ruby192/lib -LX:\lib -LX:/lib -L. -Wl,--enable-auto-image-base,--enable-auto-import mysql2-i386-mingw32.def -lmsvcrt-ruby191 -llibmysql -lshell32 -lws2_32
client.o: In function `nogvl_connect':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:111: undefined reference to `mysql_real_connect@32'
client.o: In function `nogvl_init':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:102: undefined reference to `mysql_init@4'
client.o: In function `set_ssl_options':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:612: undefined reference to `mysql_ssl_set@24'
client.o: In function `set_charset_name':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:600: undefined reference to `mysql_options@12'
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:602: undefined reference to `mysql_error@4'
client.o: In function `set_connect_timeout':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:571: undefined reference to `mysql_options@12'
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:573: undefined reference to `mysql_error@4'
client.o: In function `set_reconnect':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:554: undefined reference to `mysql_options@12'
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:556: undefined reference to `mysql_error@4'
client.o: In function `nogvl_ping':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:530: undefined reference to `mysql_ping@4'
client.o: In function `rb_mysql_client_thread_id':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:522: undefined reference to `mysql_thread_id@4'
client.o: In function `rb_mysql_client_last_id':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:502: undefined reference to `mysql_insert_id@4'
client.o: In function `nogvl_store_result':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:242: undefined reference to `mysql_store_result@4'
client.o: In function `nogvl_read_query_result':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:234: undefined reference to `mysql_read_query_result@4'
client.o: In function `rb_mysql_client_server_info':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:481: undefined reference to `mysql_get_server_version@4'
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:482: undefined reference to `mysql_get_server_info@4'
client.o: In function `rb_mysql_client_info':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:454: undefined reference to `mysql_get_client_version@0'
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:455: undefined reference to `mysql_get_client_info@0'
client.o: In function `rb_mysql_client_escape':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:422: undefined reference to `mysql_real_escape_string@16'
client.o: In function `nogvl_send_query':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:222: undefined reference to `mysql_send_query@12'
client.o: In function `nogvl_close':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:148: undefined reference to `mysql_close@4'
client.o: In function `rb_raise_mysql2_error':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:77: undefined reference to `mysql_error@4'
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:78: undefined reference to `mysql_sqlstate@4'
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:92: undefined reference to `mysql_errno@4'
client.o: In function `rb_mysql_client_affected_rows':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:510: undefined reference to `mysql_affected_rows@4'
client.o: In function `rb_mysql_client_async_result':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:266: undefined reference to `mysql_field_count@4'
client.o: In function `nogvl_close':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:148: undefined reference to `mysql_close@4'
client.o: In function `init_mysql2_client':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:640: undefined reference to `mysql_get_client_info@0'
result.o: In function `rb_mysql_result_fetch_field':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:82: undefined reference to `mysql_fetch_field_direct@8'
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:70: undefined reference to `mysql_num_fields@4'
result.o: In function `rb_mysql_result_fetch_fields':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:314: undefined reference to `mysql_num_fields@4'
result.o: In function `nogvl_fetch_row':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:61: undefined reference to `mysql_fetch_row@4'
result.o: In function `rb_mysql_result_free_result':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:40: undefined reference to `mysql_free_result@4'
result.o: In function `rb_mysql_result_fetch_row':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:133: undefined reference to `mysql_fetch_fields@4'
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:134: undefined reference to `mysql_fetch_lengths@4'
result.o: In function `rb_mysql_result_free_result':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:40: undefined reference to `mysql_free_result@4'
result.o: In function `rb_mysql_result_fetch_row':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:136: undefined reference to `mysql_num_fields@4'
result.o: In function `rb_mysql_result_each':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:381: undefined reference to `mysql_num_rows@4'
result.o: In function `rb_mysql_result_free_result':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:40: undefined reference to `mysql_free_result@4'
collect2: ld returned 1 exit status
make: *** [mysql2.so] Error 1
有什么想法吗?
I am struggling to install mysql2 gem 0.2.7, this is the output I get:
C:/RailsInstaller/Ruby192/bin/ruby.exe extconf.rb --with-mysql-dir=X: --with-mysql-lib=X:\lib
--no-rdoc --no-ri
checking for rb_thread_blocking_region()... yes
checking for main() in -llibmysql... yes
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
creating Makefile
make
gcc -I. -IC:/RailsInstaller/Ruby192/include/ruby-1.9.1/i386-mingw32 -I/C/RailsInstaller/Ruby192/include/ruby-1.9.1/ruby/backward -I/C/RailsInstaller/Ruby192/include/ruby-1.9.1 -I. -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -IX:/include -O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -Wall -funroll-loops -o client.o -c client.c
client.c: In function 'rb_mysql_client_query':
client.c:361:11: warning: unused variable 'r'
gcc -I. -IC:/RailsInstaller/Ruby192/include/ruby-1.9.1/i386-mingw32 -I/C/RailsInstaller/Ruby192/include/ruby-1.9.1/ruby/backward -I/C/RailsInstaller/Ruby192/include/ruby-1.9.1 -I. -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -IX:/include -O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -Wall -funroll-loops -o mysql2_ext.o -c mysql2_ext.c
gcc -I. -IC:/RailsInstaller/Ruby192/include/ruby-1.9.1/i386-mingw32 -I/C/RailsInstaller/Ruby192/include/ruby-1.9.1/ruby/backward -I/C/RailsInstaller/Ruby192/include/ruby-1.9.1 -I. -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -IX:/include -O3 -g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -Wall -funroll-loops -o result.o -c result.c
result.c: In function 'rb_mysql_result_fetch_fields':
result.c:318:35: warning: comparison between signed and unsigned integer expressions
gcc -shared -s -o mysql2.so client.o mysql2_ext.o result.o -L. -LC:/RailsInstaller/Ruby192/lib -LX:\lib -LX:/lib -L. -Wl,--enable-auto-image-base,--enable-auto-import mysql2-i386-mingw32.def -lmsvcrt-ruby191 -llibmysql -lshell32 -lws2_32
client.o: In function `nogvl_connect':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:111: undefined reference to `mysql_real_connect@32'
client.o: In function `nogvl_init':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:102: undefined reference to `mysql_init@4'
client.o: In function `set_ssl_options':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:612: undefined reference to `mysql_ssl_set@24'
client.o: In function `set_charset_name':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:600: undefined reference to `mysql_options@12'
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:602: undefined reference to `mysql_error@4'
client.o: In function `set_connect_timeout':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:571: undefined reference to `mysql_options@12'
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:573: undefined reference to `mysql_error@4'
client.o: In function `set_reconnect':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:554: undefined reference to `mysql_options@12'
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:556: undefined reference to `mysql_error@4'
client.o: In function `nogvl_ping':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:530: undefined reference to `mysql_ping@4'
client.o: In function `rb_mysql_client_thread_id':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:522: undefined reference to `mysql_thread_id@4'
client.o: In function `rb_mysql_client_last_id':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:502: undefined reference to `mysql_insert_id@4'
client.o: In function `nogvl_store_result':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:242: undefined reference to `mysql_store_result@4'
client.o: In function `nogvl_read_query_result':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:234: undefined reference to `mysql_read_query_result@4'
client.o: In function `rb_mysql_client_server_info':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:481: undefined reference to `mysql_get_server_version@4'
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:482: undefined reference to `mysql_get_server_info@4'
client.o: In function `rb_mysql_client_info':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:454: undefined reference to `mysql_get_client_version@0'
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:455: undefined reference to `mysql_get_client_info@0'
client.o: In function `rb_mysql_client_escape':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:422: undefined reference to `mysql_real_escape_string@16'
client.o: In function `nogvl_send_query':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:222: undefined reference to `mysql_send_query@12'
client.o: In function `nogvl_close':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:148: undefined reference to `mysql_close@4'
client.o: In function `rb_raise_mysql2_error':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:77: undefined reference to `mysql_error@4'
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:78: undefined reference to `mysql_sqlstate@4'
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:92: undefined reference to `mysql_errno@4'
client.o: In function `rb_mysql_client_affected_rows':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:510: undefined reference to `mysql_affected_rows@4'
client.o: In function `rb_mysql_client_async_result':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:266: undefined reference to `mysql_field_count@4'
client.o: In function `nogvl_close':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:148: undefined reference to `mysql_close@4'
client.o: In function `init_mysql2_client':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:640: undefined reference to `mysql_get_client_info@0'
result.o: In function `rb_mysql_result_fetch_field':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:82: undefined reference to `mysql_fetch_field_direct@8'
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:70: undefined reference to `mysql_num_fields@4'
result.o: In function `rb_mysql_result_fetch_fields':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:314: undefined reference to `mysql_num_fields@4'
result.o: In function `nogvl_fetch_row':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:61: undefined reference to `mysql_fetch_row@4'
result.o: In function `rb_mysql_result_free_result':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:40: undefined reference to `mysql_free_result@4'
result.o: In function `rb_mysql_result_fetch_row':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:133: undefined reference to `mysql_fetch_fields@4'
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:134: undefined reference to `mysql_fetch_lengths@4'
result.o: In function `rb_mysql_result_free_result':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:40: undefined reference to `mysql_free_result@4'
result.o: In function `rb_mysql_result_fetch_row':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:136: undefined reference to `mysql_num_fields@4'
result.o: In function `rb_mysql_result_each':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:381: undefined reference to `mysql_num_rows@4'
result.o: In function `rb_mysql_result_free_result':
C:\RailsInstaller\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:40: undefined reference to `mysql_free_result@4'
collect2: ld returned 1 exit status
make: *** [mysql2.so] Error 1
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我最终构建为一个直接的 ruby 扩展:
我需要单独的 include 指令,因为我使用的是 MySQL 5.5(并且看起来目录布局在 5.1 后已更改)
I ended up building as a straight ruby extension:
I needed the separate include directive, as I'm using MySQL 5.5 (and looks like the directory layout has changed post 5.1)
在Windows上使用rails 3安装mysql2 gem,可以参考安装的详细步骤 -
http://rorguide.blogspot.com/2011/03/installing-mysql2-gem-on-ruby-192-and.html
For installing mysql2 gem with rails 3 on Windows, you can refer to the detailed steps of installation on -
http://rorguide.blogspot.com/2011/03/installing-mysql2-gem-on-ruby-192-and.html
指南中详细说明的程序也不适合我。
我已经解决了将 libmysql.lib 文件从 mysql 社区服务器 zip 文件(win x86)直接复制到 gem 的 ext\mysql2 目录中的问题。这似乎使它能够正确找到该库。
mysql2 gem 的 0.3.2 版本似乎很难查询,但 github 的 master 分支 (https://github.com/brianmario/mysql2) 已修复它。
The procedure detailed in the rorguide didn't work for me either.
I've solved copying the libmysql.lib file from the mysql community server zip file (win x86) directly into the ext\mysql2 directory of the gem. This seem to make it correctly find the lib.
Version 0.3.2 of the mysql2 gem seems to hang upon query tough, but the master branch from github (https://github.com/brianmario/mysql2) has it fixed.