19

I'm using RVM to install it and it gives me this error:

The provided compiler '/usr/bin/gcc' is LLVM based, it is not yet fully supported by ruby and gems, please read `rvm requirements`.

I'm on Lion 10.7.3 and I have Xcode 4.3.1.

5
  • The most recent Ruby supports LLVM. At least, it does on my Mac. Mar 11, 2012 at 1:32
  • Yes, but am trying to install the new version with rvm.
    – xivo
    Mar 11, 2012 at 1:33
  • Unfortunately, latest LLVM don't work well with Ruby. I'm going to write a answer for this..
    – shigeya
    Mar 11, 2012 at 1:40
  • 1
    Just went through this - rvm get head fixed the issue for me.
    – Nic
    Mar 11, 2012 at 9:47
  • I verified my answer work with Xcode 4.3.2 too. so let me modify the question title.
    – shigeya
    Mar 25, 2012 at 5:54

6 Answers 6

41

Short answer is you can grab RVM master branch (not stable) to build it with LLVM (not gcc, I mistyped initially). It has appropriate patches to make 1.9.3-p125 to run (at least better) with Xcode 4.3.1 by default. I provided the patch. If you already installed RVM, rvm get head will install the master branch. With command line tools installed with Xcode 4.3.1, you can successfully install Ruby 1.9.3-p125.

Background

It's happen due to a simple configuration issue of Ruby 1.9.3-p125, it don't allow dynamic link modules to work. This happens if you're using Xcode 4.3.x (Ruby Issue#6080).

This issue have fixed in change set r34840.

RVM has patch system which provides per-version basis. This patch is included in the RVM (master branch for now) and now default for p125 configuration steps.

Xcode 4.3.x Command Line Tool

First, With Xcode 4.3.x, you need to install command line tool AFTER installing Xcode 4.3.x, by following directions: 1) Launching Xcode, 2) Open “Preferences” from the “Xcode” item on the menu bar. 3) Select “Downloads” tab (icon). 4) Click “Install” button for “Command Line Tools” (directions borrowed from my friend's site here)

If Xcode 4.3.1 is correctly installed, then cc --version should emit:

% cc --version
Apple clang version 3.1 (tags/Apple/clang-318.0.54) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.3.0
Thread model: posix

autoconf and automake

You need autoconf and automake, since Xcode 4.3.x don't have them. Install them either brew or MacPorts. With MacPorts:

sudo port install autoconf automake

Recommended installation step with RVM

Then, To install specific branch of RVM, you can:

REPO=wayneeseguin
BRANCH=master # stable for the stable branch
curl -s https://raw.github.com/${REPO}/rvm/${BRANCH}/binscripts/rvm-installer > /tmp/rvm-installer.sh
bash /tmp/rvm-installer.sh --branch ${REPO}/${BRANCH}

Or if RVM is already installed:

rvm get head   # master branch, for stable branch "rvm get stable"

After that, install openssl, iconv and readline using rvm pkg command for best result. I do following lately. Part of this might need to be included to RVM..

rvm pkg install openssl
rvm pkg install readline # if you prefer GNU readline

Then, finally, install the Ruby.

rvm install 1.9.3-p125 --patch xcode-debugopt-fix-r34840.diff --with-readline-dir=$rvm_path/usr --with-openssl-dir=$rvm_path/usr --with-tcl-lib=/usr --with-tk-lib=/usr

rvm pkg's help recommend different parameter, the help is broken. So use above for now. You need tcl/tk parameters if you have them via MacPorts(like me)

By the way, It is possible to install old Xcode then run rvm with export CC="gcc-4.2" rvm install 1.9.3-p125, but I personally think clang (LLVM) is the way to go for future, if possible.

Hope this helps.

Additional note on 2012/3/31

iconv don't need to install, also added autoconf/automake requirements for clarifications.

Additional note on 2012/4/13

Latest stable does not include the patch require dynamic link to work by default. you need to add --patch xcode-debugopt-fix-r34840.diff when you build 1.9.3-p125.

7
  • I've tried installing p125, but I get this issue: Error running 'make ', please read /Users/****/.rvm/log/ruby-1.9.3-p125/make.log There has been an error while running make. Halting the installation.
    – xivo
    Mar 11, 2012 at 1:55
  • Yeah, I'm a little new, but I'm not quite sure what I am suppose to do here with that.
    – xivo
    Mar 11, 2012 at 2:00
  • This worked perfectly! Thanks a bunch! One thing to note for myself: remember to change default ruby! :)
    – xivo
    Mar 11, 2012 at 21:33
  • I really wish people would read our rvm.io/os/osx page where we describe the issue. Also wish people would understand that if we were JUST supporting the 1.9.x series we could eliminate quite a bit of the problem and confusion, but we support all the way back to 1.8.4 and we can NOT support those with Xcode 4.3.x due to the problems listed. OSX-gcc-installer is in fact our recommended chain as it uses gcc-4.2. shigeya has been informed of this in his pull request as well as other details he glossed over.
    – ddd
    Apr 30, 2012 at 3:17
  • 1
    Correction: When you say "when you build 1.9.2-p125", I think you mean 1.9.3.
    – Hengjie
    Jul 22, 2012 at 7:25
11

As of RVM 1.10.2 all you need is to install the homebrew package apple-gcc42 and everything will "Just Work(TM)":

brew tap homebrew/dupes ; brew install apple-gcc42 ; rvm install ruby-1.9.2

Ciao!

[Updated based on comments below]

3
  • 1
    Just wanted to add, apple-gcc42 is in the homebrew dupes repository, not in the standard homebrew install. github.com/Homebrew/homebrew-dupes
    – danivovich
    Jul 16, 2012 at 13:48
  • That basically means the command should be brew install https://raw.github.com/Homebrew/homebrew-dupes/master/apple-gcc42.rb Then run CC=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2 rvm install ruby-1.9.2-p320 where the CC flags contain the path to your compiler.
    – Hengjie
    Jul 22, 2012 at 11:35
  • You don't need the CC line, since it works "automagically" in the latest RVM. I updated my answer to add the dupes stuff.
    – docwhat
    Jul 23, 2012 at 16:11
4

You just need to install gcc-4.2 in /usr/bin.

Here is the download https://github.com/downloads/kennethreitz/osx-gcc-installer/GCC-10.7-v2.pkg .

And then CC=/usr/bin/gcc-4.2 rvm install 1.8.7 --force

1
  • I actually tried this. The main issue was my XCode, but perhaps someone would find your answer helpful! Thanks :)
    – xivo
    Mar 22, 2012 at 21:37
3

I think people are confused that everyone writes

rvm get head
rvm get stable

instead you should ONLY write

rvm get head

otherwise it will not work (since stable does not have the corresponding patches yet).

0
1

I also had an issue with ruby-1.9.3-p125, here is what I did, hope this can help someone down the line.

rvm install ruby-1.9.3-p194

and checked that the new ruby installed with

rvm list

ruby-1.9.2-p318 [ x86_64 ]
ruby-1.9.3-p125 [ x86_64 ] I want to remove this one
ruby-1.9.3-p194 [ x86_64 ] I want to use this one

I then removed the old ruby version

rvm remove ruby-1.9.3-p125

and set the new one ruby ruby-1.9.3-p194 for use and install gems

rvm use ruby-1.9.3-p194

bundle install

0

I have installed and tested with the following similar to suggestions above. However I just uninstalled everything and did the basic install for all of these. The only exception was that instead of using the xcode preference dialog to install the command line tools (which failed for me). Apple posted a stand alone which I used in item 2.)

  1. Download and install xCode 4.3.2
  2. Download and Install Command line Tools for Xcode late March 2012
  3. Set xcode path $ xcode-select -switch /Application/xcode.app/Content/Developer
  4. Install Homebrew and then install git, autoconf, automake, libyaml, libksba, wget via Brew.
  5. Install RVM make sure it is setup in you shell
  6. rvm install ruby-1.9.3-p125

There are articles out there recommending this for ruby >=1.9.3 and thats all I have tested and currently use. I did install and use mysql2, sqlite, and the usual suspect (GEMs) They all compiled and passed some of my basic tests

Hope this helps.

1
  • You can install with above step, but some of dynamic link module does not work without applying post-p125 patch. See the reference in my answer.
    – shigeya
    Mar 31, 2012 at 1:56

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.