You are not logged in.

#1 2021-03-19 21:51:25

Lord Bo
Registered: 2012-11-11
Posts: 168

mysql gem outdated?

I tried to follow the Ruby on Rails guide using MySQL as database connection. I tried to install mysql for ruby using

gem install mysql

, but I got some compile errors. Seems that mysql is an outdated package and one should use mysql2. Can anyone confirm, then I would edit the wiki. The errors for reference:

Building native extensions. This could take a while...
ERROR:  Error installing mysql:
	ERROR: Failed to build gem native extension.

    current directory: /root/.gem/ruby/2.7.0/gems/mysql-2.9.1/ext/mysql_api
/usr/bin/ruby -I /usr/lib/ruby/2.7.0 -r ./siteconf20210319-39000-i4dhqu.rb extconf.rb
checking for mysql_ssl_set()... yes
checking for rb_str_set_len()... yes
checking for rb_thread_start_timer()... no
checking for mysql.h... yes
creating Makefile

current directory: /root/.gem/ruby/2.7.0/gems/mysql-2.9.1/ext/mysql_api
make DESTDIR\= clean

current directory: /root/.gem/ruby/2.7.0/gems/mysql-2.9.1/ext/mysql_api
make DESTDIR\=
compiling mysql.c
mysql.c: In function 'real_connect':
mysql.c:276:17: error: 'MYSQL' {aka 'struct st_mysql'} has no member named 'reconnect'
  276 |     myp->handler.reconnect = 0;
      |                 ^
mysql.c: In function 'real_connect2':
mysql.c:350:6: error: 'MYSQL' {aka 'struct st_mysql'} has no member named 'reconnect'
  350 |     m->reconnect = 0;
      |      ^~
mysql.c: In function 'reconnect':
mysql.c:920:27: error: 'MYSQL' {aka 'struct st_mysql'} has no member named 'reconnect'
  920 |     return GetHandler(obj)->reconnect ? Qtrue : Qfalse;
      |                           ^~
mysql.c: In function 'reconnect_set':
mysql.c:926:20: error: 'MYSQL' {aka 'struct st_mysql'} has no member named 'reconnect'
  926 |     GetHandler(obj)->reconnect = (flag == Qnil || flag == Qfalse) ? 0 : 1;
      |                    ^~
mysql.c: In function 'stmt_bind_result':
mysql.c:1320:74: error: 'rb_cFixnum' undeclared (first use in this function)
 1320 |  else if (argv[i] == rb_cNumeric || argv[i] == rb_cInteger || argv[i] == rb_cFixnum)
      |                                                                          ^~~~~~~~~~
mysql.c:1320:74: note: each undeclared identifier is reported only once for each function it appears in
make: *** [Makefile:245: mysql.o] Error 1

make failed, exit code 2

Gem files will remain installed in /root/.gem/ruby/2.7.0/gems/mysql-2.9.1 for inspection.
Results logged to /root/.gem/ruby/2.7.0/extensions/x86_64-linux/2.7.0/mysql-2.9.1/gem_make.out


Board footer

Powered by FluxBB