简体   繁体   English

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

[英]Ruby on Windows: Cannot install mysql2 gem - Failed to build gem native extension

I tried to follow posts here and there 我试图在这里那里关注帖子

But I'm nowhere near enough to reach the truth answer to this problem. 但是,我远远没有达到这个问题的真实答案。

Is there something else I'm missing here? 还有什么我在这里不见了吗?

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>

You need to use the 32-bit version of MYSQL Connector (I think you're using 64-bit) 你需要使用32位版本的MYSQL连接器 (我认为你使用的是64位)

MYSQL2 is a pain to install on Windows, but it's only because the dependencies & libraries it requires are not installed natively. MYSQL2在Windows上安装很麻烦,但这只是因为它所需的依赖项和库本身并没有安装。 You're almost there with the MYSQL C-Connector, but you'll have to uninstall & download the 32 bit version 你几乎就在那里使用MYSQL C-Connector,但你必须卸载并下载32位版本

Never mind. 没关系。

I figured out what went wrong with it. 我弄清楚它出了什么问题。

Because I installed 32bit MySQL Connector ver 6.0 when it should have been ver 6.1 , which is what I originally installed from the beginning. 因为我安装了32位MySQL Connector ver 6.0 ,它应该是ver 6.1 ,这是我最初安装的。

I got so caught up with the posts and forums here and there that I forgot to double check my originally installation first before blindly accept other people's online solutions. 我对这里和那里的帖子和论坛非常了解,我忘了在盲目接受其他人的在线解决方案之前先仔细检查我原来的安装。

All good now. 一切都好。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 mysql2 gem无法在Windows 7上安装:无法生成gem本机扩展 - mysql2 gem failing to install on Windows 7: failed to build gem native extension 无法构建gem本机扩展:无法安装Rails + MySQL2 - Failed to build gem native extension: Unable to install Rails + MySQL2 安装mysql2 gem时出错:无法构建gem原生扩展 - Error installing mysql2 gem: Failed to build gem native extension 安装 mysql2 时出错:无法构建 gem 原生扩展 - Error installing mysql2: Failed to build gem native extension 错误:无法构建 gem 本机扩展(rails 3.2.3 上的 mysql2) - ERROR: Failed to build gem native extension (mysql2 on rails 3.2.3) 错误:无法构建 gem 原生扩展 - 安装 mysql2 时出错 - ERROR: Failed to build gem native extension - Error installing mysql2 我得到“未能构建 gem 原生扩展”。 当我尝试安装 mysql2 (OSX) - I get "failed to build gem native extension." when I'm trying to install mysql2 (OSX) 尝试在Windows 8和Ruby 2上安装mysql2 gem - Trying to install mysql2 gem on Windows 8 with Ruby 2 使用原生扩展安装 mysql2 0.4.10 Gem::Ext::BuildError: ERROR: Failed to build gem native extension - Installing mysql2 0.4.10 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension 带有本机扩展的 MySQL2 错误:无法构建 gem 本机扩展。 (宝石::安装程序::ExtensionBuildError) - MySQL2 with native extensions ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM