mysql2
mysql2 copied to clipboard
version 5.3.0 fails to build on Centos and ruby 2.7
Hi I'm unable to install version 0.5.3 on centos and ruby 2.7. I see following error. I'm interested in this version because it has keyword arguments fixes.
As you can see, the version 0.5.2 works fine.
[sneha-somwanshi@slave]$ gem install mysql2 --version=0.5.2
Fetching mysql2-0.5.2.gem
Building native extensions. This could take a while...
Successfully installed mysql2-0.5.2
1 gem installed
[sneha-somwanshi@slave]$ gem install mysql2 --version=0.5.3
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
current directory: /home/sneha-somwanshi/.gem/ruby/2.7.0/gems/mysql2-0.5.3/ext/mysql2
/opt/rubies/2.7.0/bin/ruby -I /opt/rubies/2.7.0/lib/ruby/2.7.0 -r ./siteconf20200121-154288-i1zc6g.rb extconf.rb
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for rb_wait_for_single_fd()... yes
-----
Using mysql_config at /usr/bin/mysql_config
-----
checking for mysql.h... yes
checking for errmsg.h... yes
checking for SSL_MODE_DISABLED in mysql.h... no
checking for MYSQL_OPT_SSL_ENFORCE in mysql.h... no
checking for MYSQL.net.vio in mysql.h... yes
checking for MYSQL.net.pvio in mysql.h... no
checking for MYSQL_ENABLE_CLEARTEXT_PLUGIN in mysql.h... no
checking for SERVER_QUERY_NO_GOOD_INDEX_USED in mysql.h... yes
checking for SERVER_QUERY_NO_INDEX_USED in mysql.h... yes
checking for SERVER_QUERY_WAS_SLOW in mysql.h... no
checking for MYSQL_OPTION_MULTI_STATEMENTS_ON in mysql.h... yes
checking for MYSQL_OPTION_MULTI_STATEMENTS_OFF in mysql.h... yes
checking for my_bool in mysql.h... yes
-----
Setting libpath to /usr/lib64/mysql
-----
creating Makefile
current directory: /home/sneha-somwanshi/.gem/ruby/2.7.0/gems/mysql2-0.5.3/ext/mysql2
make "DESTDIR=" clean
current directory: /home/sneha-somwanshi/.gem/ruby/2.7.0/gems/mysql2-0.5.3/ext/mysql2
make "DESTDIR="
compiling client.c
client.c: In function ‘rb_mysql_query’:
client.c:787: warning: passing argument 1 of ‘rb_rescue2’ from incompatible pointer type
/opt/rubies/2.7.0/include/ruby-2.7.0/ruby/ruby.h:1988: note: expected ‘VALUE (*)(VALUE)’ but argument is of type ‘VALUE (*)(void *)’
client.c:795: warning: passing argument 1 of ‘rb_rescue2’ from incompatible pointer type
/opt/rubies/2.7.0/include/ruby-2.7.0/ruby/ruby.h:1988: note: expected ‘VALUE (*)(VALUE)’ but argument is of type ‘VALUE (*)(void *)’
client.c: In function ‘_mysql_client_options’:
client.c:911: error: ‘MYSQL_DEFAULT_AUTH’ undeclared (first use in this function)
client.c:911: error: (Each undeclared identifier is reported only once
client.c:911: error: for each function it appears in.)
client.c: In function ‘set_default_auth’:
client.c:1350: error: ‘MYSQL_DEFAULT_AUTH’ undeclared (first use in this function)
At top level:
cc1: warning: unrecognized command line option "-Wno-used-but-marked-unused"
cc1: warning: unrecognized command line option "-Wno-static-in-inline"
cc1: warning: unrecognized command line option "-Wno-reserved-id-macro"
cc1: warning: unrecognized command line option "-Wno-missing-variable-declarations"
cc1: warning: unrecognized command line option "-Wno-documentation-unknown-command"
cc1: warning: unrecognized command line option "-Wno-disabled-macro-expansion"
cc1: warning: unrecognized command line option "-Wno-covered-switch-default"
cc1: warning: unrecognized command line option "-Wno-conditional-uninitialized"
cc1: warning: unrecognized command line option "-Wno-tautological-compare"
cc1: warning: unrecognized command line option "-Wno-self-assign"
cc1: warning: unrecognized command line option "-Wno-parentheses-equality"
cc1: warning: unrecognized command line option "-Wno-constant-logical-operand"
cc1: warning: unrecognized command line option "-Wno-cast-function-type"
make: *** [client.o] Error 1
make failed, exit code 2
Gem files will remain installed in /home/sneha-somwanshi/.gem/ruby/2.7.0/gems/mysql2-0.5.3 for inspection.
Results logged to /home/sneha-somwanshi/.gem/ruby/2.7.0/extensions/x86_64-linux/2.7.0-static/mysql2-0.5.3/gem_make.out
What version of CentOS is this? What version of MySQL are you linking against?
mysql Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64) using readline 5.1
CentOS release 6.10 (Final)
Same here:
mysql Ver 15.1 Distrib 10.1.29-MariaDB, for Linux (x86_64) using EditLine wrapper
CentOS release 6.10 (Final)
On
Red Hat Enterprise 6.9, mysql Ver 14.14 Distrib 5.1.73 and ruby 2.5.3
I can install 0.5.3 with:
gem install mysql2 -v '0.5.3' -- --srcdir=/usr/include/mysql
Version 0.5.2 installs without giving --srcdir However, both (0.5.2 and 0.5.3) fail with:
LoadError: cannot load such file -- mysql2/mysql2
upon requiring the gem.
@snehaso : Are you able to load/require version 0.5.2 of the gem?
On my development machine (OS X) I have "mysql2.bundle" in ".../mysql2-0.5.2/lib/mysql2/" - this file does not exist on my production machine.
Update: I can use 0.5.2 provided I do not use the Option
--srcdir=/usr/include/mysql
(turns out I had that stuck in bundle/config). The issue with 0.5.3 remains as described above.
Btw: Without the --srcdir option the build of 0.5.3 also fails for me with
‘MYSQL_DEFAULT_AUTH’ undeclared ...
Also fails on 4.1.12-124.32.3.el6uek.x86_64 for me without the --srcdir=/usr/include/mysql
compiling client.c client.c: In function 'rb_mysql_query': client.c:787: warning: passing argument 1 of 'rb_rescue2' from incompatible pointer type /rvm/rubies/ruby-2.7.0/include/ruby-2.7.0/ruby/ruby.h:1988: note: expected 'VALUE ()(VALUE)' but argument is of type 'VALUE ()(void )' client.c:795: warning: passing argument 1 of 'rb_rescue2' from incompatible pointer type /rvm/rubies/ruby-2.7.0/include/ruby-2.7.0/ruby/ruby.h:1988: note: expected 'VALUE ()(VALUE)' but argument is of type 'VALUE (*)(void *)' client.c: In function '_mysql_client_options': client.c:911: error: 'MYSQL_DEFAULT_AUTH' undeclared (first use in this function) client.c:911: error: (Each undeclared identifier is reported only once client.c:911: error: for each function it appears in.) client.c: In function 'set_default_auth': client.c:1350: error: 'MYSQL_DEFAULT_AUTH' undeclared (first use in this function)
Looks like this affects 2.7 on all platforms. It has been fixed in https://github.com/brianmario/mysql2/commit/f62edc0d17b3c31fdf2d5581a82feec8393239d2 which was December, but we're still waiting for a release?
We were able to get around the client.c:1350: error: ‘MYSQL_DEFAULT_AUTH’ undeclared (first use in this function)
error in 0.5.3 by making sure the "devel" package is installed on the server. See also: https://github.com/brianmario/mysql2/issues/1118#issuecomment-663176270
@cschoene Thank you, that worked for me! I need to get my client off of CentOS at some point :)
This isn't specific to CentOS.