【问题标题】:Redmine - An error occurred while installing mysql2 (0.3.16), and Bundler cannot continueRedmine - 安装 mysql2 (0.3.16) 时出错,Bundler 无法继续
【发布时间】:2014-11-07 07:29:22
【问题描述】:

我在 Digital Ocean 云服务器上安装 Redmine 时遇到了这个问题(我使用的是 Centos 7)。在我bundle install 之后,我收到了这个错误信息,

An error occurred while installing mysql2 (0.3.16), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.16'` succeeds before bundling.

然后我尝试使用这个命令安装mysql2

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 -r ./siteconf20140913-16462-tdplhf-0.rb 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

extconf failed, exit code 1

Gem files will remain installed in /usr/lib64/ruby/gems/1.8/gems/mysql2-0.3.16 for inspection.
Results logged to /usr/lib64/ruby/gems/1.8/extensions/x86_64-linux/1.8/mysql2-0.3.16/gem_make.out

我按照本教程学习如何设置 Ruby on Rails:https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-on-centos-6

还有Redmine:http://www.redmine.org/projects/redmine/wiki/How_to_Install_Redmine_on_CentOS_(Detailed)

【问题讨论】:

标签: ruby-on-rails ruby redmine mysql2 centos7


【解决方案1】:

尝试安装mysql-devel包再试

yum install mysql-devel

【讨论】:

    【解决方案2】:

    谁有这个问题,我就是这样做的

    首先安装最新版本的mysql通过运行安装到你的机器上

    brew升级mysql

    然后运行

    sudo gem 安装 mysql2

    【讨论】:

      【解决方案3】:

      在我的 Mac 上,我也遇到了这个问题。

      brew install mysql
      

      这个命令安装了mysql,之后我可以重复命令:

      bundle install
      

      它!

      【讨论】:

        猜你喜欢
        • 2014-11-04
        • 2018-01-10
        • 1970-01-01
        • 2022-07-08
        • 1970-01-01
        • 2016-03-14
        • 2022-01-20
        • 2017-02-09
        • 2018-09-08
        相关资源
        最近更新 更多