2009-11-03 26 views
0

我的最终目标是Radiant CMS安装的本地开发。所以,需要导轨和数据库才能发挥出色。以前使用mysql的挫败使我尝试了mamp。我已经安装了MAMP。这是工作。不过,我对其他途径持开放态度。在雪豹上安装MySQL gem install失败。我的电脑是32位(mac mini core duo)

试图安装MySQL的宝石,但没有爱。

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 

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

我安装了xcode。

我该如何获得这颗宝石?

回答

0

你在机器上安装了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 
+0

感谢。我确实安装了mysql(有点)。我安装了MAMP,因此我的mysql位于 /Applications/MAMP/Library/bin – 2009-11-03 14:31:57

+0

我打算将MAMP排除在外,并使用hivelogic中的说明安装mysql。 – 2009-11-03 14:42:31

+0

这里有一个教程,其中有适合MAMP和MySQL gem的选项:http://boonedocks.net/mike/archives/175-MAMP-and-the-Ruby-MySQL-Gem.html – 2009-11-03 15:08:24

0

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

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

编辑:刚才注意到你发现Hivelogic。这是要走的路。一旦编译完成后,你不能按照指示将mysql gem指向正确的方向。另外,我相信让宝石工作的文档是另一个令人头疼的问题,我会让它滑下来。

+0

我几乎总共noob所以我有点担心修改hivelogic指令来安装32位而不是64位版本的mysql。我们看看事情会怎样。 – 2009-11-04 03:44:47

+0

你可以使用“./configure”命令来提示你的环境的具体细节。假如你不下载任何64位特定的代码,你会没事的。这些说明中没有任何内容似乎是64位特定的。 – cgr 2009-11-04 04:51:51

0

如果通过自制mysql安装您可以使用此:

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

的“ - ”添加额外的配置参数时是有帮助的。

借助捆绑,你应该做的事情,像这样:

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