在64位CentOS上安装Mysql Ruby gem

我在64位CentOS机器上安装mysql ruby​​ gem时出现问题。

[jacekb@vitaidealn ~]$ uname -a Linux vitaidealn.local 2.6.18-92.el5 #1 SMP Tue Jun 10 18:51:06 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux 

安装了Mysql和mysql-devel软件包。 Mysql_config提供以下path:

 Usage: /usr/lib64/mysql/mysql_config [OPTIONS] Options: --cflags [-I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv] --include [-I/usr/include/mysql] --libs [-L/usr/lib64/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -L/usr/lib64 -lssl -lcrypto] --libs_r [-L/usr/lib64/mysql -lmysqlclient_r -lz -lpthread -lcrypt -lnsl -lm -lpthread -L/usr/lib64 -lssl -lcrypto] --socket [/var/lib/mysql/mysql.sock] --port [3306] --version [5.0.45] --libmysqld-libs [-L/usr/lib64/mysql -lmysqld -lz -lpthread -lcrypt -lnsl -lm -lpthread -lrt -L/usr/lib64 -lssl -lcrypto] 

试图安装:

 [jacekb@vitaidealn ~]$ gem install mysql -- --with-mysql-include=/usr/include/mysql --with-mysql-libs=/usr/lib64/mysql ... ERROR: Error installing mysql: ERROR: Failed to build gem native extension. /usr/bin/ruby extconf.rb --with-mysql-include=/usr/include/mysql --with-mysql-libs=/usr/lib64/mysql checking for mysql_query() in -lmysqlclient... no checking for main() in -lm... no 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... 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. 

我将不胜感激任何帮助。 谢谢阅读 :)。

我认为你需要mysql-client的devel包。 尝试安装它:

 yum install mysql-devel 

我很久以前写了一篇博客文章 。 抱歉堵塞;-)

答案是运行

 gem install mysql -- --with-mysql-conf=/usr/bin/mysql --with-mysql-lib=/usr/lib/mysql 

你将不得不使用lib64path,显然。 也许这也会帮助你。

您可能想知道EPEL中有一个ruby-mysql包。 可能有趣的看看:)

尝试这个:

 1. yum uninstall mysql 2. yum install mysql 3. yum install mysql-devel (to install development libraries, For Debian, Knoppix, Buildix user apt-get install libmysqlclient15-dev) 4. gem install mysql 

我碰到了你所描述的同样的问题。 通过执行以下操作来解决它(作为课程的根本):

cd /usr/lib64
ln -nfs /usr/lib64/mysql/libmysqlclient.so.15 libmysqlclient.so
ldconfig

之后,我能够简单地运行gem install mysql ,而且一切正常。

希望这可以帮助!

在我的情况下,它的工作

 sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config