开发者

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

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.

Here is the output

Here is the 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:

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. You may find you need to force-rebuild all of your brew packages.

Under MacPorts you just remove the /opt directory, salvaging any database files that might be in there first, and re-install everything again. I'm sure there's a similar procedure for Brew.

There's a way to alter the library load path, too, to set priority, but MacPorts does seem to handle this for you. otool can help diagnose which libraries are being loaded:

otool -L `which ruby`


  • Remove RVM, thus making for a cleaner install later:

    $ RVM implode

  • Remove XCode:

    $ 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. llvm will NOT compile ruby.

(One can always re-install from the AppStore later)

  • download and install GCC-10.7-v2.pkg from https://github.com/kennethreitz/osx-gcc-installer/downloads

This will install just the bare-bones GCC compiler. 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.

  • reinstall RVM: http://beginrescueend.com/rvm/install/

  • Install the package manager "homebrew" from Link and with it install libiconv.

    $ brew install libiconv

This will install several files to homebrew's home directory "/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

At this point you should have everything in place to install ruby 1.9.2 using RVM:

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)

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. 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.


I find this incredibly difficult and prohibiting adoption of ruby 1.9. Surely the ruby guys can make this a no-brainer install?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜