5

rvm install 1.9.3 --with-gcc=clang (as suggested by Can't install Ruby under Lion with RVM – GCC issues) doesn't work because neither Mac OS X 10.8.2 (Mountain Lion) nor Xcode 4.5 comes with clang.

Is it possible to compile Ruby with llvm?

According to Matthias Schmidt's "How to install Ruby 1.9.3 on Mac OS X with LLVM and rbenv", Ruby is now fully compatible with LLVM.

But, I still get: error: C compiler cannot create executables

UPDATE:

Actually, I found clang here /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang (thanks to the Node.js Installation Wiki). I just didn't have clang in my path.

So, if I add clang to my path, is rvm install 1.9.3 --with-gcc=clang sufficient?

Community
  • 1
  • 1
ma11hew28
  • 121,420
  • 116
  • 450
  • 651
  • this error does not need to be result of compiler itself, sometimes conflicting compilation/environment flags or libraries can cause it. – mpapis Sep 26 '12 at 14:39

3 Answers3

12

From RVM notes:

Homebrew:

If you are using Homebrew, you can install the apple-gcc42 and required libraries from homebrew/dupes:

  brew update
  brew tap homebrew/dupes
  brew install autoconf automake apple-gcc42
  rvm pkg install openssl

This can live side by side with an existing Xcode 4.2+ install or Command Line Tools for Xcode.

osx-gcc-installer:

If you don't use Homebrew, you can download and install osx-gcc-installer:
https://github.com/kennethreitz/osx-gcc-installer.

Hope it will help you.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
ExiRe
  • 4,727
  • 7
  • 47
  • 92
3

no, ruby is not fully compatible with llvm, there is at least one issue with Fibers and other issues might occur if version of llvm changes.

Ruby works best with gcc-4.2, rvm provides information how to get it (+other important stuff):

rvm requirements
mpapis
  • 52,729
  • 14
  • 121
  • 158
  • I found `clang`. So, is `rvm install 1.9.3 --with-gcc=clang` OK? – ma11hew28 Sep 26 '12 at 20:58
  • clang is not ok, it uses llvm ... unless you have clang version from GNU not llvm. – mpapis Sep 26 '12 at 22:27
  • Thanks to your help, I've documented a temporary workaround for this issue until it's addressed (in RVM 1.17). [How to Install RVM without Xcode Command Line Tools](https://gist.github.com/3789921) – ma11hew28 Oct 04 '12 at 23:23
0

I used this: http://railsinstaller.org/mac - and it was a BREEZE. Also I like the sublime text editor, found that through this resource... Maybe I'll say goodbye to macvim! Imagine that.

Jeremy Iglehart
  • 4,281
  • 5
  • 25
  • 38