Ubuntu: Ruby und MySQL

Möchte man das RubyGem mysql unter Ubuntu oder Kubuntu installieren, ist es zunächst notwendig, die Dev-Sourcen des MySQL-Clients zu installieren, sonst kommt es zu folgender Fehlermeldung:

$ sudo gem install mysql
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
        ERROR: Failed to build gem native extension.
 
/usr/bin/ruby1.8 extconf.rb install mysql
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... no
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
*** 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.
[...]

Die Fehlermeldung weist darauf hin, dass die Client-Sourcen von MySQL finden; bei der Erstellung der nativen Anteile der Ruby-MySQL-Bindings wird versucht, gegen die Bibliothek mit den entsprechenden Routinen zu binden (-lmysqlclient).

Die notwendige Entwickler-Bibliothek des MySQL-Clients kann folgendermaßen installiert werden:

$ sudo apt-get install libmysqlclient15-dev

Danach kann dann das mysql-Gem installiert werden:

$ sudo gem install mysql

Fertig.

Ähnliche Artikel in diesem Blog:

Tags: , , , , , ,

Eine Reaktion zu “Ubuntu: Ruby und MySQL”

  1. Jens

    Super! Danke, das hat das Problem gelöst.

Einen Kommentar schreiben

Dieses Blog verwendet Textile für Textauszeichnungen. HTML wird nicht unterstützt.