Ruby on Windows:无法安装mysql2 gem - 无法构建gem原生扩展

时间:2014-03-10 00:41:53

标签: ruby-on-rails ruby windows

我尝试关注帖子herethere

但是我还远远没有达到这个问题的真实答案。

我在这里还有别的东西吗?

d:\Projects\Ruby\cms>gem install mysql2 --platform=ruby -- '--with-mysql-dir="C:\mysql-connector-c-6.1.3-winx64"'
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:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb --with-mysql-dir="C:\mysql-connector-c-6.1.3-winx64"
checking for ruby/thread.h... no
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
-----
Using --with-mysql-dir=C:\mysql-connector-c-6.1.3-winx64
-----
checking for main() in -llibmysql... yes
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
-----
Setting rpath to /lib
-----
creating Makefile

make
generating mysql2-i386-mingw32.def
compiling client.c
client.c: In function 'finish_and_mark_inactive':
client.c:513:3: warning: ISO C90 forbids mixed declarations and code
compiling infile.c
compiling mysql2_ext.c
compiling result.c
result.c: In function 'rb_mysql_result_fetch_fields':
result.c:415:35: warning: comparison between signed and unsigned integer expressions linking shared-object mysql2/mysql2.so
client.o: In function `nogvl_connect':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:157: undefined reference to `mysql_real_connect@32'
client.o: In function `nogvl_init':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:146: undefined reference to `mysql_init@4'
client.o: In function `set_ssl_options':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:1102: undefined reference to `mysql_ssl_set@24'
client.o: In function `mysql_client_options':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:744: undefined reference to `mysql_options@12'
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:748: undefined reference to `mysql_error@4'
client.o: In function `rb_mysql_info':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:271: undefined reference to `mysql_info@4'
client.o: In function `rb_mysql_client_warning_count':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:261: undefined reference to `mysql_warning_count@4'
client.o: In function `nogvl_do_result':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:375: undefined reference to `mysql_store_result@4'
client.o: In function `rb_mysql_client_more_results':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:947: undefined reference to `mysql_more_results@4'
client.o: In function `nogvl_select_db':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:887: undefined reference to `mysql_select_db@8'
client.o: In function `nogvl_ping':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:918: undefined reference to `mysql_ping@4'
client.o: In function `rb_mysql_client_thread_id':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:880: undefined reference to `mysql_thread_id@4'
client.o: In function `rb_mysql_client_last_id':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:849: undefined reference to `mysql_insert_id@4'
client.o: In function `nogvl_read_query_result':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:362: undefined reference to `mysql_read_query_result@4'
client.o: In function `rb_mysql_client_server_info':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:809: undefined reference to `mysql_get_server_version@4'
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:810: undefined reference to `mysql_get_server_info@4'
client.o: In function `rb_mysql_client_info':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:777: undefined reference to `mysql_get_client_version@0'
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:778: undefined reference to `mysql_get_client_info@0'
client.o: In function `rb_mysql_client_real_escape':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:667: undefined reference to `mysql_real_escape_string@16'
client.o: In function `finish_and_mark_inactive':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:520: undefined reference to `mysql_free_result@4'
client.o: In function `nogvl_send_query':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:339: undefined reference to `mysql_send_query@12'
client.o: In function `nogvl_close':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:189: undefined reference to `mysql_close@4'
client.o: In function `rb_mysql_client_escape':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:242: undefined reference to `mysql_escape_string@12'
client.o: In function `rb_raise_mysql2_error':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:125: undefined reference to `mysql_error@4'
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:126: undefined reference to `mysql_sqlstate@4'
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:135: undefined reference to `mysql_errno@4'
client.o: In function `rb_connect':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:301: undefined reference to `mysql_errno@4'
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:309: undefined reference to `mysql_get_server_version@4'
client.o: In function `rb_mysql_client_store_result':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:990: undefined reference to `mysql_errno@4'
client.o: In function `rb_mysql_client_next_result':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:963: undefined reference to `mysql_next_result@4'
client.o: In function `rb_mysql_client_affected_rows':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:863: undefined reference to `mysql_affected_rows@4'
client.o: In function `rb_mysql_client_async_result':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:424: undefined reference to `mysql_errno@4'
client.o: In function `rb_mysql_client_abandon_results':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:544: undefined reference to `mysql_next_result@4'
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:543: undefined reference to `mysql_more_results@4'
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:552: undefined reference to `mysql_free_result@4'
client.o: In function `nogvl_do_result':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:373: undefined reference to `mysql_use_result@4'
client.o: In function `nogvl_close':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:189: undefined reference to `mysql_close@4'
client.o: In function `set_charset_name':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:1091: undefined reference to `mysql_options@12'
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:1093: undefined reference to `mysql_error@4'
client.o: In function `nogvl_close':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:189: undefined reference to `mysql_close@4'
client.o: In function `init_mysql2_client':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/client.c:1141: undefined reference to `mysql_get_client_info@0'
infile.o: In function `mysql2_set_local_infile':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/infile.c:114: undefined reference to `mysql_set_local_infile_handler'
result.o: In function `rb_mysql_result_count':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/result.c:592: undefined reference to `mysql_num_rows@4'
result.o: In function `rb_mysql_result_fetch_field':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/result.c:123: undefined reference to `mysql_fetch_field_direct@8'
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/result.c:111: undefined reference to `mysql_num_fields@4'
result.o: In function `rb_mysql_result_fetch_fields':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/result.c:411: undefined reference to `mysql_num_fields@4'
result.o: In function `nogvl_fetch_row':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/result.c:102: undefined reference to `mysql_fetch_row@4'
result.o: In function `rb_mysql_result_free_result':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/result.c:76: undefined reference to `mysql_free_result@4'
result.o: In function `rb_mysql_result_fetch_row':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/result.c:209: undefined reference to `mysql_fetch_lengths@4'
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/result.c:211: undefined reference to `mysql_num_fields@4'
result.o: In function `rb_mysql_result_each':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/result.c:512: undefined reference to `mysql_fetch_fields@4'
result.o: In function `rb_mysql_result_free_result':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/result.c:76: undefined reference to `mysql_free_result@4'
result.o: In function `rb_mysql_result_each':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/result.c:530: undefined reference to `mysql_error@4'
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/result.c:547: undefined reference to `mysql_fetch_fields@4'
result.o: In function `rb_mysql_result_free_result':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/result.c:76: undefined reference to `mysql_free_result@4'
result.o: In function `rb_mysql_result_each':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/result.c:499: undefined reference to `mysql_num_rows@4'
result.o: In function `rb_mysql_result_free_result':
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\mysql2-0.3.15\ext\mysql2/result.c:76: undefined reference to `mysql_free_result@4'
collect2: ld returned 1 exit status
make: *** [mysql2.so] Error 1


Gem files will remain installed in C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.15 for inspection.
Results logged to C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.15/ext/mysql2/gem_make.out

d:\Projects\Ruby\cms>

2 个答案:

答案 0 :(得分:6)

您需要使用the 32-bit version of MYSQL Connector(我认为您使用的是64位)

MYSQL2在Windows上安装很痛苦,但这仅仅是因为依赖关系&它需要的库本身不是安装的。你几乎就在那里使用MYSQL C-Connector,但你必须卸载&下载32位版本

答案 1 :(得分:0)

没关系。

我弄清楚它出了什么问题。

因为我应该安装32位MySQL连接器版本6.0 版本6.1 ,这是我最初安装的。

我对这里和那里的帖子和论坛非常了解,我忘记在盲目接受其他人的在线解决方案之前先仔细检查我原来的安装。

现在好了。