【问题标题】:Install MySQL gem for Ruby along with JRuby gem为 Ruby 安装 MySQL gem 和 JRuby gem
【发布时间】:2010-01-24 16:18:31
【问题描述】:

我的机器上安装了 JRuby MySQL gem。但是,由于某种原因,我不得不更改为 Ruby 而不是 JRuby,除了未安装用于 Ruby 的 MySQL gem 之外,一切似乎都运行良好,现在当我尝试安装它时,出现以下错误:

Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
    ERROR: Failed to build gem native extension.

/usr/bin/ruby1.8 extconf.rb --with-mysql-dir=/usr/include/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... 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... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... 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.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include

我搜索了一下,发现我可能需要安装libmysqlclient12-dev 包。

但是当我尝试这样做时,出现以下错误:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package libmysqlclient12-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package libmysqlclient12-dev has no installation candidate

现在我似乎正在碰壁,而不是继续前进。任何指针或帮助将不胜感激。

干杯

【问题讨论】:

    标签: mysql ruby rubygems jruby


    【解决方案1】:

    我有同样的问题。我做了

    apt-get install libmysqlclient-dev
    

    在 Ubuntu 上,它工作正常。

    【讨论】:

      【解决方案2】:

      您使用的是哪个 gem 命令?红宝石一号还是朱红一号?

      如果您使用的是 *unix,请尝试 which gem

      查看您的路径以确保 C-ruby 二进制文件位于 JRuby 二进制文件之前(如果您不再使用 JRuby,则将其从您的路径中删除)。

      【讨论】:

        【解决方案3】:

        我从包管理器中猜测您正在运行 Linux。

        libmysqlclient12-dev 是一个 Ubuntu 软件包。如果您正在运行其他发行版,则很可能只是命名为其他发行版。我相信您需要的 Fedora 软件包是 mysql-devel。如果您搜索一下您的发行版和 libmysqlclient12-dev 的名称,您可能可以准确找到它的名称。

        您的发行版可能还包含一些 gem 的预构建版本。 Fedora(这是我使用的)没有预先构建 mysql gem,但另一个分发可能。在 Fedora 中,它们被命名为 rubygem-GEMNAME,具体取决于 gem。比如sqlite预建的gem是rubygem-sqlite3-ruby

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2011-08-02
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多