简体   繁体   English

在OS X Lion上安装带有RVM的Ruby 1.9.2失败

[英]Installing Ruby 1.9.2 with RVM fails on OS X Lion

I'm on Lion, I've installed xcode 4.1, and rvm version is 1.6.31 head 我在Lion上,我已经安装了xcode 4.1,而rvm版本是1.6.31头

Here's what I did: 这是我做的:

$ rvm install 1.9.2-p290 --with-iconv-dir=/usr/local/Cellar/libiconv/1.13.1

The iconv dir points to the Brew install. iconv目录指向Brew安装。

Here is the output 这是输出

Here is the make.log 这是make.log

The error at the bottom of the make.log looks like it's trying to use the native libiconv instead of the one I specified: make.log底部的错误看起来像是尝试使用本机libiconv而不是我指定的那个:

ld: in /Developer/SDKs/MacOSX10.7.sdk/usr/local/lib/libiconv.2.dylib, file was built for unsupported file format which is not the architecture being linked (x86_64) for architecture x86_64

Any ideas? 有任何想法吗?

When upgrading from 10.5 to 10.6 I had to nuke out all my installed source-built libraries and start over to fully resolve the 32-bit to 64-bit conversion issues. 当从10.5升级到10.6时,我不得不核对所有已安装的源代码库,并重新开始完全解决32位到64位的转换问题。 You may find you need to force-rebuild all of your brew packages. 您可能会发现需要强制重建所有brew包。

Under MacPorts you just remove the /opt directory, salvaging any database files that might be in there first, and re-install everything again. 在MacPorts下,您只需删除/opt目录,抢救可能首先存在的所有数据库文件,然后重新安装所有内容。 I'm sure there's a similar procedure for Brew. 我确信Brew的程序类似。

There's a way to alter the library load path, too, to set priority, but MacPorts does seem to handle this for you. 有一种方法可以改变库加载路径,以设置优先级,但MacPorts似乎确实为您处理了这个问题。 otool can help diagnose which libraries are being loaded: otool可以帮助诊断正在加载哪些库:

otool -L `which ruby`
  • Remove RVM, thus making for a cleaner install later: 删除RVM,从而使以后更清洁:

    $ RVM implode $ RVM内爆

  • Remove XCode: 删除XCode:

    $ sudo /Developer/Library/uninstall-devtools –mode=all $ sudo / Developer / Library / uninstall-devtools -mode = all

XCode is removed since in 4.2, at least, all references to gcc are linked to llvm-gcc (Apple's) own fork of gcc. XCode被删除,因为在4.2中,至少所有对gcc的引用都链接到llvm-gcc(Apple)自己的gcc fork。 llvm will NOT compile ruby. llvm不会编译ruby。

(One can always re-install from the AppStore later) (以后总是可以从AppStore重新安装)

This will install just the bare-bones GCC compiler. 这将只安装裸机GCC编译器。 It can safely be overwritten by XCode if you decide to reinstall it, or simple removed using the same command as that used for removing XCode. 如果您决定重新安装它,或者使用与删除XCode相同的命令进行简单删除,则XCode可以安全地覆盖它。

This will install several files to homebrew's home directory "/usr/local/cellar" 这将安装几个文件到homebrew的主目录“/ usr / local / cellar”

  • backup /usr/local/lib/libiconv.2.dylib, and copy /usr/local/cellar/libiconv/1.14/lib/libiconv.2.dylib into it's place in /usr/local/lib 备份/usr/local/lib/libiconv.2.dylib,并将/usr/local/cellar/libiconv/1.14/lib/libiconv.2.dylib复制到/ usr / local / lib中的位置

At this point you should have everything in place to install ruby 1.9.2 using RVM: 此时,您应该已准备好使用RVM安装ruby 1.9.2的所有内容:

CC=gcc-4.2 rvm install 1.9.2-p290 --with-iconv-dir=/usr/local/Cellar/libiconv/1.14.1

(RVM does not actually support --with-iconv-dir, if you check the config.log file, but it might someday... in which case the copying of libiconv will be unnecessary) (RVM实际上不支持--with-iconv-dir,如果你检查config.log文件,但它可能有一天......在这种情况下,复制libiconv将是不必要的)

Now go install gems and rails and anything else you might need. 现在去安装宝石和导轨以及您可能需要的任何其他东西。

Ruby won't install with llvm, and gcc is now sym-linked to llvm. Ruby不会与llvm一起安装,而gcc现在与sym链接到llvm。 The simple fix is to use 简单的解决方法是使用

CC=gcc-4.2 rvm install 1.9.2-p290 --with-iconv-dir=/usr/local/Cellar/libiconv/1.13.1

to force it to build with the real gcc. 强迫它用真正的gcc构建。

I find this incredibly difficult and prohibiting adoption of ruby 1.9. 我发现这非常困难并禁止采用ruby 1.9。 Surely the ruby guys can make this a no-brainer install? 当然红宝石家伙可以安装这个吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM