Tengo dificultades para instalar Ruby Gems en mi Ubuntu 19.04. Cada vez que intento instalar la gema, aparece un error, código de salida 2. Sin embargo, MySQL está instalado correctamente en mi sistema operativo. E incluso el servidor Ruby funciona, pero sin la base de datos MySQL.
greyshader@ScarlettHaven:~$ sudo gem install mysql
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.5.0/gems/mysql-2.9.1/ext/mysql_api
/usr/bin/ruby2.5 -r ./siteconf20190611-30763-iq3xfl.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: /var/lib/gems/2.5.0/gems/mysql-2.9.1/ext/mysql_api
make "DESTDIR=" clean
current directory: /var/lib/gems/2.5.0/gems/mysql-2.9.1/ext/mysql_api
make "DESTDIR="
compiling mysql.c
mysql.c: In function ‘stmt_bind_result’:
mysql.c:1320:74: error: ‘rb_cFixnum’ undeclared (first use in this function); did you mean ‘rb_isalnum’?
else if (argv[i] == rb_cNumeric || argv[i] == rb_cInteger || argv[i] == rb_cFixnum)
^~~~~~~~~~
rb_isalnum
mysql.c:1320:74: note: each undeclared identifier is reported only once for each function it appears in
make: *** [Makefile:243: mysql.o] Error 1
make failed, exit code 2
Gem files will remain installed in /var/lib/gems/2.5.0/gems/mysql-2.9.1 for inspection.
Results logged to /var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/mysql-2.9.1/gem_make.out
Mi versión Ruby es:
greyshader@ScarlettHaven:~$ ruby --version
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
Mi versión de rieles es:
greyshader@ScarlettHaven:~$ rails --version
Rails 6.0.0.rc1
Pero cuando intento ver la versión en MySQL, aparece un error:
greyshader@ScarlettHaven:~$ mysql -version
ERROR 1045 (28000): Access denied for user 'greyshader'@'localhost' `(using password: NO)`
Respuesta1
Parece ser que esta joya ya no es compatible. Intente usar mysql2-gem en su lugar