【问题标题】:mysql gem install fails on snow leopard. My computer is 32bit (mac mini core duo)mysql gem install 在雪豹上失败。我的电脑是 32 位的(mac mini core duo)
【发布时间】:2009-11-03 14:16:13
【问题描述】:

我的最终目标是在本地开发 Radiant CMS 安装。因此,需要 rails 和 db 才能发挥出色。以前对 mysql 的挫败感让我尝试了 mamp。我已经安装了 MAMP。这是工作。不过,我对其他途径持开放态度。

尝试安装 mysql gem 但没有得到爱。

john-breedloves-mac-mini-2:~ john_breedlove$ sudo gem install mysqlPassword:
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
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... yes
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
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:
    <Omitted>


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out

我发现了很多关于在升级到雪豹后安装 gems 的建议,但所有好的答案似乎都指向人们安装 64 位版本的 mysql。我有一个 32 位处理器。

我已经安装了 xcode。

如何安装这个 gem?

【问题讨论】:

    标签: mysql ruby-on-rails


    【解决方案1】:

    你的机器上安装mysql了吗?
    这是你必须做的第一件事。

    那么 Mac OS 的问题是它不会在与 linux 上相同的标准位置安装东西。所以必须指定mysql目录。

    使用 macports mysql,我执行以下操作:

    sudo gem install mysql --with-mysql-include=/opt/local/include/mysql5 --with-mysql-lib=/opt/local/lib/mysql5 --with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config
    

    【讨论】:

    • 谢谢。我确实安装了mysql(有点)。我安装了 MAMP,所以我的 mysql 位于 /Applications/MAMP/Library/bin
    • 我将把 MAMP 排除在外,并按照 hivelogic 上的说明安装 mysql。
    • There's a tutorial here with the appropriate options for MAMP and the MySQL gem : boonedocks.net/mike/archives/…
    【解决方案2】:

    简而言之,您将需要手动编译 mysql 以获得所需的库。 当你这样做时,你可能不需要 mamp :P 我只是手动启动 mysql,并使用开发环境。

    http://hivelogic.com/articles/compiling-mysql-on-snow-leopard/

    编辑:刚刚注意到你找到了 Hivelogic。这就是要走的路。编译后,您无法按照说明将 mysql gem 指向正确的方向。另外,我相信让文档为 gem 工作是另一个令人头疼的问题,我会让它滑倒。

    【讨论】:

    • 我几乎是个菜鸟,所以我有点担心修改 hivelogic 指令来安装 32 位而不是 64 位版本的 mysql。我们将看看它是如何进行的。
    • 你会没事的,它提到的“./configure”命令可以确定你的环境的细节。如果您不下载任何 64 位特定代码,您会没事的。这些说明中的任何内容似乎都不是 64 位特定的。
    【解决方案3】:

    如果你通过自制软件安装了 mysql,你可能会使用这个:

    sudo gem install mysql -- --with-mysql-include=/usr/local/include/mysql --with-mysql-lib=/usr/local/lib/mysql 
    

    “--”在添加其他配置参数时很有帮助。

    使用 bundler 你应该这样做:

    # bundle config build.mysql --with-mysql-config=/usr/local/bin/mysql_config
    # bundle install
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-04
      • 2010-12-27
      • 1970-01-01
      • 2010-11-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多