Dificultades para instalar mysql gem en Ubuntu


Estoy intentando instalar la gema mysql 2.8.1. Lo estaría usando para construir una aplicación Rails 2.0.2 en Ubuntu 10.04. Yo estaría usando Ruby 1.8.7. He instalado las dependencias de desarrollo (otras gemas). Por algunas razones no puedo instalarlo. No soy capaz de averiguar exactamente cómo arreglarlo. Por favor, ayuda!!

Obtengo lo siguiente en el terminal cuando intento instalarlo:

mohnish@pc146724-desktop:~/Downloads$ sudo gem install mysql-2.8.1.gem 
Building native extensions.  This could take a while...
ERROR:  Error installing mysql-2.8.1.gem:
    ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/bin/ruby1.8
    --with-mysql-config
    --without-mysql-config
    --with-mysql-dir
    --without-mysql-dir
    --with-mysql-include
    --without-mysql-include=${mysql-dir}/include
    --with-mysql-lib
    --without-mysql-lib=${mysql-dir}/lib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-mlib
    --without-mlib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-zlib
    --without-zlib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-socketlib
    --without-socketlib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-nsllib
    --without-nsllib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-mygcclib
    --without-mygcclib
    --with-mysqlclientlib
    --without-mysqlclientlib


Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
mohnish@pc146724-desktop:~/Downloads$ 

¡Gracias por tu ayuda!!

Author: Matt Briggs, 2011-01-06

4 answers

Pruebe esto y luego instale la gema mysql:

sudo apt-get install libmysqlclient-dev 

Si eso no es suficiente, inténtalo así

 sudo apt-get install libmysqlclient-dev libmysqlclient16 ruby-dev
 120
Author: Zabba,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-05-11 19:47:08

Pruebe esto y luego instale la gema mysql:

Sudo apt-get install libmysqlclient-dev libmysqlclient16

Esto funcionó después de ejecutar sudo gem install mysql.

La documentación todavía no se instala correctamente (montones de errores "Sin definición", aunque eso no es realmente un problema.

 9
Author: Andrew Plummer,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-02-15 10:17:55

Usted debe hacer lo que el mensaje de error le dice: compruebe el mkmf.¡tronco! Busque este archivo usando find/usr/lib/ruby/gems/1.8/ gems / - name mkmf.registro. Por lo general, este mensaje de error aparece porque olvidó instalar el paquete-dev para la extensión que estaba intentando instalar. Así que si querías instalar la gema mysql, probablemente olvidaste instalar el libmysqlclient14-dev primero. Haga una búsqueda apt-cache / grep dev para encontrar los paquetes apropiados.

Por favor compruebe esto para más información

 2
Author: Andrei Andrushkevich,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-01-06 09:05:34

En mi caso, tuve el siguiente mensaje de error:

Se produjo un error al instalar mysql (2.8.1), y Bundler no puede continuar. Asegúrese de que gem install mysql -v '2.8.1' tenga éxito antes de liar.

Intenté: gem install mysql -v '2.8.1', y recibí un mensaje de error similar al que recibiste.

Lo arreglé haciendo lo siguiente:

  • PASO (1): ejecute esto: sudo apt-get install libmysqlclient-dev

  • PASO (2): instalar mysql: gem install mysql -v 2.8.1

Debería recibir un mensaje de éxito similar a esto:

Instalado correctamente mysql-2.8.1
Instalando la documentación de ri para mysql-2.8.1 1 gema instalada

Espero que mi respuesta ayude.

 0
Author: almawhoob,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-05-31 15:29:53