Microsoft
Software
Hardware
Network
Question : How to install MySQL Gem for use with Rails on Linux
Hi,
I'm trying to install Rails on a SuSE Linux Enterprise Server 10.
I want to use Rails with a MySQL database, so I need to install the MySQL gem. I don't have it installed and as a consequence, I think, in the log files I see a lot of MySQL connection problems. The connection is severed on very many, but not all, requests. Sometimes is works, most of the time doesn't and the server dies (503)
When I try to install it fails:
user@epf:~> sudo gem install mysql
root's password:
Bulk updating Gem source index for:
http://gems.rubyforge.org
Select which gem to install for your platform (x86_64-linux)
1. mysql 2.7.3 (mswin32)
2. mysql 2.7.1 (mswin32)
3. mysql 2.7 (ruby)
4. mysql 2.6 (ruby)
5. Skip this gem
6. Cancel installation
> 3
Building native extensions. This could take a while...
ERROR: While executing gem ... (Gem::Installer::Extension
BuildError
)
ERROR: Failed to build gem native extension.
ruby 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... 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
*** 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=${op
t-dir}/inc
lude
--with-opt-lib
--without-opt-lib=${opt-di
r}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby
--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=${mysq
l-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
In the readme is some information on alternatives for installing. These also fail, for example:
ruby extconf.rb
ruby extconf.rb
epf:/usr/lib/ruby/gems/1.8
/gems/mysq
l-2.7 # ruby 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
*** 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=${op
t-dir}/inc
lude
--with-opt-lib
--without-opt-lib=${opt-di
r}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby
--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=${mysq
l-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
epf:/usr/lib/ruby/gems/1.8
/gems/mysq
l-2.7 #
Running the following is also not succesful:
ruby extconf.rb --with-mysql-dir= /usr/lib64/mysql
ruby extconf.rb --without-mysqlclientlib
env LD_RUN_PATH=/usr/lib64/
ruby extconf.rb
How can install the MySQL gem on SuSE Linux enterprise 10?
Answer : How to install MySQL Gem for use with Rails on Linux
From what you display it looks, that you first need to install mysql-client itself. If you already have it, try to search for 'dev' version of the package. I don't know SuSE packages exactly, but root cause of your problem is missing library called 'mysqlclient'. Probably it should be in /usr/lib or /usr/local/lib. You can verify it by trying to list it:
ls /usr/lib/libmysqlclient*
ls /usr/local/lib/libmysqlcli
ent*
If both result with "No such file or directory", you miss libraries.
Random Solutions
Printing a Cover Sheet with Every Print Job
Create a Batch File to remove network printers from network pc's
SSRS v2005 -- conditional report
Header file path
ERROR: the text, netext, and image data types are invalid in this subquery or aggregate expression
How to use VBA to add a calendar entry to a shared calendar
Logon batch file help
Exchange 2003 - Store disk activity
Where can i get an iso image of windows 2000 sp4
missing asms file