如何为Ruby开发安装Xcode 4.1

时间:2012-06-13 00:00:10

标签: ruby xcode install

如何在没有'LLVM'的情况下安装gcc?

我想安装一个较旧的Xcode副本,以便我可以在Ruby 1.8.7上进行Ruby开发。在我通过应用商店从4.1升级到4.3之前,这曾经在我的机器上工作。一旦我升级,我发现许多宝石都无法编译。 (TheRubyRacer,MySQL)我已经使用sudo /Developer/Library/uninstall-devtools --mode=all命令从我的系统中删除了4.1和4.3。重启后,我确认gcc命令失败,Xcode未列在Applications文件夹中。

我从开发人员中心下载了Xcode 4.1 for Lion并安装了它。不幸的是,我仍然无法从之前建造宝石。我从gcc检查了版本,我看到我确实安装了4.2。

gcc --version

i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

gem install mysql的错误如下

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

        /Users/jjasonclark/.rvm/rubies/ruby-1.8.7-p358/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:
    --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=/Users/jjasonclark/.rvm/rubies/ruby-1.8.7-p358/bin/ruby
    --with-mysql-config
    --without-mysql-config
    --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-mysqlclientlib
    --without-mysqlclientlib
    --with-mlib
    --without-mlib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-zlib
    --without-zlib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-socketlib
    --without-socketlib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-nsllib
    --without-nsllib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-mygcclib
    --without-mygcclib
    --with-mysqlclientlib
    --without-mysqlclientlib


Gem files will remain installed in /Users/jjasonclark/.rvm/gems/ruby-1.8.7-p358/gems/mysql-2.8.1 for inspection.
Results logged to /Users/jjasonclark/.rvm/gems/ruby-1.8.7-p358/gems/mysql-2.8.1/ext/mysql_api/gem_make.out

1 个答案:

答案 0 :(得分:0)

我永远无法让Xcode使用旧的Ruby副本。我的解决方案是安装osx-gcc-installer