Issue Updating Ruby on MAC With Xcode 4.3.1

Issue updating Ruby on Mac with Xcode 4.3.1

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.

'gem install nokogiri' fails in `bundle install` [Mac OS X Lion]

i solved the problem by reinstalling ruby using the following Gist: gist.github.com/1856859. A friend pointed out that the --with-gcc=clang option during install is important for Lion/Snow Leopard

Trouble Installing Ruby 1.9.2 on OSX - Readline and Make errors

Are you compiling Readline from source? It might be less painful to compile and install Readline via Homebrew, assuming that you have at least one working version of Ruby on your system.

Once you've done that, you can try the RVM install of Ruby 1.9.2 again, and it should skip the Readline compilation step.

Updated in response to comment:

So you are using a Homebrew installed Readline. In that case, find out where the new (less broken) Readline libs are installed, and try passing the location of that version of Readline to the RVM install process. Something like:

rvm install ruby-1.9.2-p320 -C
--with-readline-dir=/usr/local/Cellar/readline/6.2.1

Clearly, your directory will be slightly different the one in my example.

Installing Ruby 1.9.3 Troubles with Clang

Refer to this answer.

Even though both ruby-1.9.3-p125 and ruby-1.9.3-p194 some support for clang, installing Ruby with clang is generally not recommended.

(Note: I had to accept edit proposal first, then edit. Thank you very much for contribution.)



Related Topics



Leave a reply



Submit