Skip to content

Instantly share code, notes, and snippets.

@kaysiz
Created June 16, 2020 07:14
Show Gist options
  • Select an option

  • Save kaysiz/46e428be7fd2544463224df7d4c75beb to your computer and use it in GitHub Desktop.

Select an option

Save kaysiz/46e428be7fd2544463224df7d4c75beb to your computer and use it in GitHub Desktop.
msql2-0.3.18 error
Fetching mysql2 0.3.18
Installing mysql2 0.3.18 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/kaysiz/.rvm/gems/ruby-1.9.3-p448@fisheagle/gems/mysql2-0.3.18/ext/mysql2
/home/kaysiz/.rvm/rubies/ruby-1.9.3-p448/bin/ruby -r ./siteconf20200615-123870-1yv7ael.rb extconf.rb
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 mysql_config at /usr/bin/mysql_config
-----
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
-----
Setting libpath to /usr/lib/x86_64-linux-gnu
-----
creating Makefile
current directory: /home/kaysiz/.rvm/gems/ruby-1.9.3-p448@fisheagle/gems/mysql2-0.3.18/ext/mysql2
make clean
current directory: /home/kaysiz/.rvm/gems/ruby-1.9.3-p448@fisheagle/gems/mysql2-0.3.18/ext/mysql2
make
compiling result.c
result.c: In function ‘msec_char_to_uint’:
result.c:186:17: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’}
[-Wsign-compare]
186 | for (i = 0; i < (len - 1); i++) {
| ^
In file included from ./mysql2_ext.h:41,
from result.c:1:
result.c: In function ‘rb_mysql_result_fetch_row’:
./client.h:9:29: warning: cast between incompatible function types from ‘void * (*)(void *)’ to ‘VALUE (*)(void *)’ {aka ‘long unsigned int
(*)(void *)’} [-Wcast-function-type]
9 | rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
| ^
result.c:213:20: note: in expansion of macro ‘rb_thread_call_without_gvl’
213 | row = (MYSQL_ROW)rb_thread_call_without_gvl(nogvl_fetch_row, ptr, RUBY_UBF_IO, 0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
result.c:257:14: warning: this statement may fall through [-Wimplicit-fallthrough=]
257 | if (castBool && fields[i].length == 1) {
| ^
result.c:261:9: note: here
261 | case MYSQL_TYPE_SHORT: /* SMALLINT field */
| ^~~~
compiling infile.c
compiling client.c
In file included from ./mysql2_ext.h:41,
from client.c:1:
client.c: In function ‘rb_connect’:
./client.h:9:29: warning: cast between incompatible function types from ‘void * (*)(void *)’ to ‘VALUE (*)(void *)’ {aka ‘long unsigned int
(*)(void *)’} [-Wcast-function-type]
9 | rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
| ^
client.c:351:16: note: in expansion of macro ‘rb_thread_call_without_gvl’
351 | rv = (VALUE) rb_thread_call_without_gvl(nogvl_connect, &args, RUBY_UBF_IO, 0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
./client.h:9:29: warning: cast between incompatible function types from ‘void * (*)(void *)’ to ‘VALUE (*)(void *)’ {aka ‘long unsigned int
(*)(void *)’} [-Wcast-function-type]
9 | rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
| ^
client.c:369:20: note: in expansion of macro ‘rb_thread_call_without_gvl’
369 | rv = (VALUE) rb_thread_call_without_gvl(nogvl_connect, &args, RUBY_UBF_IO, 0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
client.c: In function ‘rb_mysql_client_close’:
./client.h:9:29: warning: cast between incompatible function types from ‘void * (*)(void *)’ to ‘VALUE (*)(void *)’ {aka ‘long unsigned int
(*)(void *)’} [-Wcast-function-type]
9 | rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
| ^
client.c:393:5: note: in expansion of macro ‘rb_thread_call_without_gvl’
393 | rb_thread_call_without_gvl(nogvl_close, wrapper, RUBY_UBF_IO, 0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
client.c: In function ‘do_send_query’:
./client.h:9:29: warning: cast between incompatible function types from ‘void * (*)(void *)’ to ‘VALUE (*)(void *)’ {aka ‘long unsigned int
(*)(void *)’} [-Wcast-function-type]
9 | rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
| ^
client.c:416:14: note: in expansion of macro ‘rb_thread_call_without_gvl’
416 | if ((VALUE)rb_thread_call_without_gvl(nogvl_send_query, args, RUBY_UBF_IO, 0) == Qfalse) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
client.c: In function ‘nogvl_read_query_result’:
client.c:431:3: error: unknown type name ‘my_bool’; did you mean ‘bool’?
431 | my_bool res = mysql_read_query_result(client);
| ^~~~~~~
| bool
In file included from ./mysql2_ext.h:41,
from client.c:1:
client.c: In function ‘rb_mysql_client_async_result’:
./client.h:9:29: warning: cast between incompatible function types from ‘void * (*)(void *)’ to ‘VALUE (*)(void *)’ {aka ‘long unsigned int
(*)(void *)’} [-Wcast-function-type]
9 | rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
| ^
client.c:479:14: note: in expansion of macro ‘rb_thread_call_without_gvl’
479 | if ((VALUE)rb_thread_call_without_gvl(nogvl_read_query_result, wrapper->client, RUBY_UBF_IO, 0) == Qfalse) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
./client.h:9:29: warning: cast between incompatible function types from ‘void * (*)(void *)’ to ‘VALUE (*)(void *)’ {aka ‘long unsigned int
(*)(void *)’} [-Wcast-function-type]
9 | rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
| ^
client.c:487:27: note: in expansion of macro ‘rb_thread_call_without_gvl’
487 | result = (MYSQL_RES *)rb_thread_call_without_gvl(nogvl_use_result, wrapper, RUBY_UBF_IO, 0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
./client.h:9:29: warning: cast between incompatible function types from ‘void * (*)(void *)’ to ‘VALUE (*)(void *)’ {aka ‘long unsigned int
(*)(void *)’} [-Wcast-function-type]
9 | rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
| ^
client.c:489:27: note: in expansion of macro ‘rb_thread_call_without_gvl’
489 | result = (MYSQL_RES *)rb_thread_call_without_gvl(nogvl_store_result, wrapper, RUBY_UBF_IO, 0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
client.c: In function ‘rb_mysql_client_abandon_results’:
./client.h:9:29: warning: cast between incompatible function types from ‘void * (*)(void *)’ to ‘VALUE (*)(void *)’ {aka ‘long unsigned int
(*)(void *)’} [-Wcast-function-type]
9 | rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
| ^
client.c:621:27: note: in expansion of macro ‘rb_thread_call_without_gvl’
621 | result = (MYSQL_RES *)rb_thread_call_without_gvl(nogvl_store_result, wrapper, RUBY_UBF_IO, 0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
client.c: In function ‘_mysql_client_options’:
client.c:762:3: error: unknown type name ‘my_bool’; did you mean ‘bool’?
762 | my_bool boolval;
| ^~~~~~~
| bool
client.c:797:10: error: ‘MYSQL_SECURE_AUTH’ undeclared (first use in this function); did you mean ‘MYSQL_DEFAULT_AUTH’?
797 | case MYSQL_SECURE_AUTH:
| ^~~~~~~~~~~~~~~~~
| MYSQL_DEFAULT_AUTH
client.c:797:10: note: each undeclared identifier is reported only once for each function it appears in
In file included from ./mysql2_ext.h:41,
from client.c:1:
client.c: In function ‘rb_mysql_client_select_db’:
./client.h:9:29: warning: cast between incompatible function types from ‘void * (*)(void *)’ to ‘VALUE (*)(void *)’ {aka ‘long unsigned int
(*)(void *)’} [-Wcast-function-type]
9 | rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
| ^
client.c:992:7: note: in expansion of macro ‘rb_thread_call_without_gvl’
992 | if (rb_thread_call_without_gvl(nogvl_select_db, &args, RUBY_UBF_IO, 0) == Qfalse)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
client.c: In function ‘rb_mysql_client_ping’:
./client.h:9:29: warning: cast between incompatible function types from ‘void * (*)(void *)’ to ‘VALUE (*)(void *)’ {aka ‘long unsigned int
(*)(void *)’} [-Wcast-function-type]
9 | rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
| ^
client.c:1018:19: note: in expansion of macro ‘rb_thread_call_without_gvl’
1018 | return (VALUE)rb_thread_call_without_gvl(nogvl_ping, wrapper->client, RUBY_UBF_IO, 0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
client.c: In function ‘rb_mysql_client_store_result’:
./client.h:9:29: warning: cast between incompatible function types from ‘void * (*)(void *)’ to ‘VALUE (*)(void *)’ {aka ‘long unsigned int
(*)(void *)’} [-Wcast-function-type]
9 | rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
| ^
client.c:1070:25: note: in expansion of macro ‘rb_thread_call_without_gvl’
1070 | result = (MYSQL_RES *)rb_thread_call_without_gvl(nogvl_store_result, wrapper, RUBY_UBF_IO, 0);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
client.c: In function ‘set_secure_auth’:
client.c:1196:38: error: ‘MYSQL_SECURE_AUTH’ undeclared (first use in this function); did you mean ‘MYSQL_DEFAULT_AUTH’?
1196 | return _mysql_client_options(self, MYSQL_SECURE_AUTH, value);
| ^~~~~~~~~~~~~~~~~
| MYSQL_DEFAULT_AUTH
In file included from ./mysql2_ext.h:41,
from client.c:1:
client.c: In function ‘initialize_ext’:
./client.h:9:29: warning: cast between incompatible function types from ‘void * (*)(void *)’ to ‘VALUE (*)(void *)’ {aka ‘long unsigned int
(*)(void *)’} [-Wcast-function-type]
9 | rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
| ^
client.c:1214:14: note: in expansion of macro ‘rb_thread_call_without_gvl’
1214 | if ((VALUE)rb_thread_call_without_gvl(nogvl_init, wrapper, RUBY_UBF_IO, 0) == Qfalse) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
client.c: In function ‘set_secure_auth’:
client.c:1197:1: warning: control reaches end of non-void function [-Wreturn-type]
1197 | }
| ^
make: *** [Makefile:207: client.o] Error 1
make failed, exit code 2
Gem files will remain installed in /home/kaysiz/.rvm/gems/ruby-1.9.3-p448@fisheagle/gems/mysql2-0.3.18 for inspection.
Results logged to /home/kaysiz/.rvm/gems/ruby-1.9.3-p448@fisheagle/extensions/x86_64-linux/1.9.1/mysql2-0.3.18/gem_make.out
An error occurred while installing mysql2 (0.3.18), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.18' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
mysql2
@FreitasAssis
Copy link

Hi! How did you solve this?

@kaysiz
Copy link
Author

kaysiz commented Mar 24, 2021

Hi! How did you solve this?

hi I had to install the project in an ubuntu 14 VM, with old version of mysql

@FreitasAssis
Copy link

Do you remember what version of mysql you put? I'm having the same problem.

@sajanbasnet75
Copy link

Hey I am facing the same issue with rails 3.2.12 and ruby 1.9.3, MySQL 0.3.18

is switching the os only options to resolve this ?

@FreitasAssis
Copy link

What's your OS? I was using Linux Mint and I needed to install MySQL 5.7 to run the project.
https://www.claudiokuenzler.com/blog/991/install-mysql-5.7-on-ubuntu-20.04-focal-avoid-8.0-packages

@kaysiz
Copy link
Author

kaysiz commented Jun 2, 2021

I ended up using a VM running Ubuntu 16.04 LTS and mysql Ver 14.14 Distrib 5.7.30. This has been working fine

@sajanbasnet75
Copy link

sajanbasnet75 commented Jun 2, 2021

I am using Ubuntu 20.04.2 LTS
even tried with windows linux wsl got the same error 🤕

Thanks will try the above procedures as well.

Seems like Mysql 5.7 is not available to the Ubuntu 20.04 🤦

@FreitasAssis
Copy link

Did you see the link that I mentioned before? I remember that I installed this version on Ubuntu 20.04. I remember you can change the version on window that appears, I dont remember how to do this, but it's possible.
On Windows, with Docker (if this is your case), its dont work, because the ruby version is old, they dont serve an image ruby 1.9.3.

@sajanbasnet75
Copy link

sajanbasnet75 commented Jun 2, 2021

yea @FreitasAssis i did check it out and tried it
Also I tried this link as well
No luck

I will try with the windows wsl with ubuntu 18.04 later

@FreitasAssis
Copy link

:(
So i'm sorry, man.
I remember when you need to select MySQL 5.7, it appear other old version, but you can change it (I think clicking space button, and then, "Ok")

@sajanbasnet75
Copy link

Using windows WSL with ubuntu 18.0.4 solved the issue
Thanks guys for the help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment