gpt4 book ai didi

mysql - gem mysql2安装

转载 作者:行者123 更新时间:2023-11-30 23:02:30 24 4
gpt4 key购买 nike

需要帮助安装 mysql2。我到处搜索,感到沮丧。我是 centos 的新手,一直遇到某些障碍。我已经设法克服了大部分问题,但我正在寻求帮助。我得到以下运行gem 安装 mysql2

[root bin]# gem install mysql2
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb
checking for ruby/thread.h... no
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... no
checking for rb_hash_dup()... no
checking for rb_intern3()... no
-----
Using mysql_config at /usr/bin/mysql_config
-----
checking for mysql.h... no
checking for mysql/mysql.h... no
-----
mysql.h is missing. please check your installation of mysql and try again.
-----
*** 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/ruby
--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-mysql-config
--without-mysql-config


Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mysql2-0.3.15 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/mysql2-0.3.15/ext/mysql2/gem_make.out

当我运行 rpm -qa | grep mysql 我有以下

[root bin]# rpm -qa | grep mysql
mysql-server-5.1.73-3.el6_5.x86_64
mysql-libs-5.1.73-3.el6_5.x86_64
mysql-devel-5.1.73-3.el6_5.x86_64
mysql-5.1.73-3.el6_5.x86_64

大多数其他解决方案都说要安装 mysql-devel,但我已经安装好了。看起来我可以在/usr/include/mysql 中看到 mysql.h。大多数其他人也缺少/usr/bin/mysql_config 中的 mysql_config 行。

有没有人有什么想法。谢谢!

编辑:添加更多细节Centos 6.5 全新安装(来自 puppet labs repo 的 Puppet master,然后添加了 epel,然后安装了 theforeman,试图将 sqlite 迁移到 mysql db,但需要安装 mysql2 gem)MySQL 5.1

最佳答案

好吧,我想通了,我查看了位于/usr/lib/ruby/gems/1.8/gems/mysql2-0.3.15/ext/mysql2/mkmf.log 中的日志 mkmf.log 并注意到了

--------------------

have_header: checking for mysql.h... -------------------- yes

"gcc -E -I. -I/usr/lib64/ruby/1.8/x86_64-linux -I. -I/usr/include/mysql -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing -fPIC conftest.c$
checked program was:
/* begin */
1: #include <mysql.h>
/* end */

--------------------

它最初说不,但这是来自一个成功的日志,但我注意到的是 gcc 在该行的开头。我不知道我是否安装了 gcc,所以我安装了

yum install gcc

然后我的 gem 安装 mysql2 并修复了它。!希望这可以帮助别人。

关于mysql - gem mysql2安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23345058/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com