-
-
Save yitsushi/921486 to your computer and use it in GitHub Desktop.
C:\DevKit>gem install mysql2 -- '--with-mysql-lib="c:\Program Files\MySQL\MySQL | |
Server 5.1\lib\opt" --with-mysql-include="c:\Program Files\MySQL\MySQL Server 5. | |
1\include"' | |
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:/Ruby192/bin/ruby.exe extconf.rb --with-mysql-lib="c:\Program Files\MySQL\MySQ | |
L Server 5.1\lib\opt" --with-mysql-include="c:\Program Files\MySQL\MySQL Server | |
5.1\include" | |
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:/Ruby192/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby192/include/ruby-1 | |
.9.1/ruby/backward -I/C/Ruby192/include/ruby-1.9.1 -I. -DHAVE_RB_THREAD_BLOCKING | |
_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H "-Ic:\Program Files | |
\MySQL\MySQL Server 5.1\include" -O3 -g -Wextra -Wno-unused-parameter -Wno-pa | |
rentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-l | |
ong-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:/Ruby192/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby192/include/ruby-1 | |
.9.1/ruby/backward -I/C/Ruby192/include/ruby-1.9.1 -I. -DHAVE_RB_THREAD_BLOCKING | |
_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H "-Ic:\Program Files | |
\MySQL\MySQL Server 5.1\include" -O3 -g -Wextra -Wno-unused-parameter -Wno-pa | |
rentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-l | |
ong-long -Wall -funroll-loops -o mysql2_ext.o -c mysql2_ext.c | |
gcc -I. -IC:/Ruby192/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby192/include/ruby-1 | |
.9.1/ruby/backward -I/C/Ruby192/include/ruby-1.9.1 -I. -DHAVE_RB_THREAD_BLOCKING | |
_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H "-Ic:\Program Files | |
\MySQL\MySQL Server 5.1\include" -O3 -g -Wextra -Wno-unused-parameter -Wno-pa | |
rentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-l | |
ong-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 express | |
ions | |
gcc -shared -s -o mysql2.so client.o mysql2_ext.o result.o -L. -LC:/Ruby192/lib | |
-L"c:\Program Files\MySQL\MySQL Server 5.1\lib\opt" -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:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:111: undefi | |
ned reference to `mysql_real_connect@32' | |
client.o: In function `nogvl_init': | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:102: undefi | |
ned reference to `mysql_init@4' | |
client.o: In function `set_ssl_options': | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:612: undefi | |
ned reference to `mysql_ssl_set@24' | |
client.o: In function `set_charset_name': | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:600: undefi | |
ned reference to `mysql_options@12' | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:602: undefi | |
ned reference to `mysql_error@4' | |
client.o: In function `set_connect_timeout': | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:571: undefi | |
ned reference to `mysql_options@12' | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:573: undefi | |
ned reference to `mysql_error@4' | |
client.o: In function `set_reconnect': | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:554: undefi | |
ned reference to `mysql_options@12' | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:556: undefi | |
ned reference to `mysql_error@4' | |
client.o: In function `nogvl_ping': | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:530: undefi | |
ned reference to `mysql_ping@4' | |
client.o: In function `rb_mysql_client_thread_id': | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:522: undefi | |
ned reference to `mysql_thread_id@4' | |
client.o: In function `rb_mysql_client_last_id': | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:502: undefi | |
ned reference to `mysql_insert_id@4' | |
client.o: In function `nogvl_store_result': | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:242: undefi | |
ned reference to `mysql_store_result@4' | |
client.o: In function `nogvl_read_query_result': | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:234: undefi | |
ned reference to `mysql_read_query_result@4' | |
client.o: In function `rb_mysql_client_server_info': | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:481: undefi | |
ned reference to `mysql_get_server_version@4' | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:482: undefi | |
ned reference to `mysql_get_server_info@4' | |
client.o: In function `rb_mysql_client_info': | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:454: undefi | |
ned reference to `mysql_get_client_version@0' | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:455: undefi | |
ned reference to `mysql_get_client_info@0' | |
client.o: In function `rb_mysql_client_escape': | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:422: undefi | |
ned reference to `mysql_real_escape_string@16' | |
client.o: In function `nogvl_send_query': | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:222: undefi | |
ned reference to `mysql_send_query@12' | |
client.o: In function `nogvl_close': | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:148: undefi | |
ned reference to `mysql_close@4' | |
client.o: In function `rb_raise_mysql2_error': | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:77: undefin | |
ed reference to `mysql_error@4' | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:78: undefin | |
ed reference to `mysql_sqlstate@4' | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:92: undefin | |
ed reference to `mysql_errno@4' | |
client.o: In function `rb_mysql_client_affected_rows': | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:510: undefi | |
ned reference to `mysql_affected_rows@4' | |
client.o: In function `rb_mysql_client_async_result': | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:266: undefi | |
ned reference to `mysql_field_count@4' | |
client.o: In function `nogvl_close': | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:148: undefi | |
ned reference to `mysql_close@4' | |
client.o: In function `init_mysql2_client': | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/client.c:640: undefi | |
ned reference to `mysql_get_client_info@0' | |
result.o: In function `rb_mysql_result_fetch_field': | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:82: undefin | |
ed reference to `mysql_fetch_field_direct@8' | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:70: undefin | |
ed reference to `mysql_num_fields@4' | |
result.o: In function `rb_mysql_result_fetch_fields': | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:314: undefi | |
ned reference to `mysql_num_fields@4' | |
result.o: In function `nogvl_fetch_row': | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:61: undefin | |
ed reference to `mysql_fetch_row@4' | |
result.o: In function `rb_mysql_result_free_result': | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:40: undefin | |
ed reference to `mysql_free_result@4' | |
result.o: In function `rb_mysql_result_fetch_row': | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:133: undefi | |
ned reference to `mysql_fetch_fields@4' | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:134: undefi | |
ned reference to `mysql_fetch_lengths@4' | |
result.o: In function `rb_mysql_result_free_result': | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:40: undefin | |
ed reference to `mysql_free_result@4' | |
result.o: In function `rb_mysql_result_fetch_row': | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:136: undefi | |
ned reference to `mysql_num_fields@4' | |
result.o: In function `rb_mysql_result_each': | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:381: undefi | |
ned reference to `mysql_num_rows@4' | |
result.o: In function `rb_mysql_result_free_result': | |
C:\Ruby192\lib\ruby\gems\1.9.1\gems\mysql2-0.2.7\ext\mysql2/result.c:40: undefin | |
ed reference to `mysql_free_result@4' | |
collect2: ld returned 1 exit status | |
make: *** [mysql2.so] Error 1 | |
Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql2-0. | |
2.7 for inspection. | |
Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql2-0.2.7/ext/mysql2/ge | |
m_make.out |
nop... ='(
I gave up. I don't like Windows and i reinstall my computer at work with my lovely Gentoo... It's usable... more useable... (or any linux eg Ubuntu)
The original post and comments:
http://rorguide.blogspot.com/2011/03/installing-mysql2-gem-on-ruby-192-and.html
Aye, I've come from there :) I noticed that it only happens with the 64-bit version of mysql, the gem (in fact, both the mysql and the mysql2 gem) compiles just fine with the 32-bit version. But my database corrupts binary blobs from dumps if I install the 32-bit version, so that's not an option...
And.. Did you try to force start at 32bit the gem/ruby?
The whole ruby (+rails) run as 32bit application... ^_^ I haven't got Windows now but if i meet then i try it... if you do it pls let me know the result.
Hm, how would I do that? With the 64-bit mysql, the dll is probably meant for 64-bit applications, but I've looked for a 64-bit DevKit but without success (I guess it should work for both 32-bit and 64-bit dlls?). The problem itself seems to be due to name mangling, but that goes a bit deeper than my knowledge of C++...
Edit: Well, compiling with the 32-bit dll works, and that does let me access a 64-bit mysqld - even if everything that is 32-bit is the DLL that the gem uses. Except that it still corrupts my binary blobs - but at least they're read just fine from the dump into the database now, as I was able to confirm by accessing the database from a Mac's mysql gem...
While it's odd that the 32-bit version of the MySQL libraries seem to do that, it's a different problem entirely, so I guess this one is kind of solved :p
then... If i have a single 32bit dll of MySQLd then i can compile it?
- install 32bit mysql
- sompile as 32bit gem
- uninstall 32bit mysql
- install 64bit mysql
because the meg is just a connector
or:
- download anywhere the DLL-s (only without install)
- gem --with-mysql-lib
???
The latter should work. I downloaded both no-install packages and switched those around; the 32-bit one for compilation, then I switched to the 64-bit one and made sure the 32-bit DLL was first in the path so the gem would find that first (I guess it's possible to put it into the ruby/bin directory, too). You'll need to stop the mysqld service every time you do the switching. You will need the 32-bit DLL for running applications with the compiled gem, or the application will complain that "%1 is not a valid 32-bit windows application" when it tries to load the DLL.
I'm absolutely not certain whether this is the best or even a good solution, too. Particularly since it involves accessing a 64-bit mysqld with a 32-bit DLL.
I'd suggest against using the MySQL installer, it kept leaving fragments in the registry and didn't clean up the services with deinstallation, for me.
The ruby gem is just a Connector...
Same problem here, did you find a solution? It seems to be a linker error of sorts...