mysql2宝石安装失败(mysql2 gem installation fails)

2019-09-21 16:10发布

我栈如下:

  • CentOS的6.3
  • 安装了MySQL 5.5(随后在步骤http://www.if-not-true-then-false.com/2010/install-mysql-on-fedora-centos-red-hat-rhel/因为百胜仍具有MySQL 5.1中和如果我尝试百胜安装mysql的任何相关的包时,它当然会破百胜将预期5.1)

    $>的MySQL --version MySQL的版本14.14 DISTRIB 5.5.27,对于使用的readline 5.1的Linux(x86_64的)

    $>红宝石--version红宝石1.9.3p194(2012-04-20的修订35410)[x86_64的Linux的]

    $> RVM --version RVM 1.14.6(稳定)由韦恩E. Seguin的,米甲Papis [https://rvm.io/]

    $> UNAME -a Linux的localhost.mkf 2.6.32-279.5.1.el6.x86_64#1 SMP星期二8月14日23点54分45秒UTC 2012 x86_64的x86_64的x86_64的GNU / Linux的

    $> nginx的-v nginx的版本:nginx的/ 1.2.2

    $>轨道-v的Rails 3.2.6

当我尝试安装mysql2宝石,我得到以下错误:

$> gem install mysql2
Building native extensions.  This could take a while...
ERROR:  Error installing mysql2:
        ERROR: Failed to build gem native extension.

        /usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
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
--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/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby
--with-mysql-config
--without-mysql-config


Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11       for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p194/gems/mysql2-    0.3.11/ext/mysql2/gem_make.out

当我做

$> find / -name mysql.h  

我什么也没得到

MySQL是正常运行,我已经创建了数据库,并在它的表和SQL没有任何问题运行。

是否有可能已经安装在我的筹码mysql2宝石? 如果是这样那么任何想法我失踪?

更新 :我想yum install mysql-devel ,因为我已经安装mysql5.5,使用雷米·库它抛出错误。 虽然百胜预计MySQL 5.1中

Answer 1:

我得到这个工作:

 wget http://cdn.mysql.com/Downloads/MySQL-5.5/MySQL-devel-5.5.27-1.el6.x86_64.rpm 

 rpm -Uvh MySQL-devel-5.5.27-1.el6.x86_64.rpm 

 gem install mysql 

 gem install mysql2


Answer 2:

你安装mysql ? 如果不这样做你也需要安装MySQL的开发文件宝石的本地编译

sudo yum install mysql-devel

检查这已经说明错误通过捆扎机安装mysql2宝石



Answer 3:

如果得到这样的错误

$ sudo yum install mysql-devel

Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
10gen                                                                                                                                                      | 2.5 kB     00:00
base                                                                                                                                                       | 3.7 kB     00:00
centosplus                                                                                                                                                 | 3.4 kB     00:00
Not using downloaded repomd.xml because it is older than what we have:
  Current   : Wed Feb 12 07:03:25 2014
  Downloaded: Sat Jan  4 21:29:15 2014
contrib                                                                                                                                                    | 2.9 kB     00:00
epel                                                                                                                                                       | 4.2 kB     00:00
epel/primary_db                                                                                                                                            | 5.9 MB     00:00
extras                                                                                                                                                     | 3.4 kB     00:00
newrelic                                                                                                                                                   |  951 B     00:00
rpmforge                                                                                                                                                   | 1.9 kB     00:00
rpmforge-extras                                                                                                                                            | 1.9 kB     00:00
ucloud                                                                                                                                                     | 1.3 kB     00:00
updates                                                                                                                                                    | 3.4 kB     00:00
updates/primary_db                                                                                                                                         | 2.0 MB     00:00
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql-devel.x86_64 0:5.1.73-3.el6_5 will be installed
--> Processing Dependency: mysql = 5.1.73-3.el6_5 for package: mysql-devel-5.1.73-3.el6_5.x86_64
--> Finished Dependency Resolution
Error: Package: mysql-devel-5.1.73-3.el6_5.x86_64 (updates)
           Requires: mysql = 5.1.73-3.el6_5
           Installed: mysql-5.5.34-1.el6.remi.x86_64 (@remi)
               mysql = 5.5.34-1.el6.remi
           Available: mysql-5.1.71-1.el6.x86_64 (base)
               mysql = 5.1.71-1.el6
           Available: mysql-5.1.73-3.el6_5.x86_64 (updates)
               mysql = 5.1.73-3.el6_5
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

尝试这个

sudo yum --enablerepo=remi -y install mysql-devel


Answer 4:

要获得头文件的任何软件,你需要安装-dev-devel变种。 由于您使用的是非标准RPM,你可能想看看如果同一源有该版本。

一旦这些被安装,你不应该有任何问题。



文章来源: mysql2 gem installation fails