Skip to content


No require_gcc() for ruby-1.9.3-p125? #130

telemachus opened this Issue · 14 comments

10 participants


I'm wondering if it would make sense to remove the requirement of gcc-4.2 for ruby-1.9.3-p125.

  • It will now build with CC=/usr/bin/gcc or --with-gcc=clang. (I've tested both now, and in answer to a question posed on Twitter, tests pass as well).
  • Part of the point of the release is that it fixes compiler-related bugs in OSX.
  • Newer versions of Xcode simply don't have gcc-4.2. So this would help people with more recent installs of OSX, Xcode tools, etc. (A note to self and others: If you really want gcc-4.2, this walkthrough gets the job done.)




ruby-build is not working with Command Line Tools for Xcode


@rafaelfranca If you comment out the first line of share/ruby-build/1.9.3-p125 (which calls require_gcc), then it will work if you run it like this:

CC=/usr/bin/gcc bin/ruby-build share/ruby-build/1.9.3-p125 <target-directory>

Yeah, I tried this without success. The fail was the configure step in ruby compilation. But this is not ruby-build fault


Ah, then actually I'm not sure what's up. I have only the command line tools for Xcode installed, and I was able to build 1.9.3-p125 successfully that way. Are you building an different Ruby interpreter?


I'm not sure too. I'll try again later. But this issue remains valid since we don't need the require_gcc at top of 1.9.3-p125 file


@rafaelfranca Did you set the CC environment variable? I first tried without it, and configure failed because it was using gcc-4.2 as compiler (which doesn't exist on my system).

I compiled the new Ruby successfully using rbenv + ruby-build and the Command Line Tools for Xcode like this:

env CC=/usr/bin/gcc rbenv install 1.9.3-p125

Yeah. With the CC environment variable it worked.


Removing the require_gcc line for 1.9.3-p125 and compiling it with the CC environment variable also fixed building gems with native extensions for me with Xcode 4.3 + command line tools package installed.


I installed the Command Line Tools for Xcode

After removing the require_gcc line from share/ruby-build/1.9.3-p125, Ruby 1.9.3-p125 successfully compiled with rbenv install 1.9.3-p125. To set the environment variable CC was not required.


I'm using rbenv + ruby-build.

I have both Xcode 4.3 and the Command line tools for Xcode installed on 2 different macbook pros
-- one was upgraded from Snow Leopard to Lion, one came with Lion pre-installed.

I had to set the CC environment variable on the macbook with Lion pre-installed before ruby would compile successfully.
The compilation fails with the following error message otherwise:

checking build system type... x86_64-apple-darwin11.3.0
checking host system type... x86_64-apple-darwin11.3.0
checking target system type... x86_64-apple-darwin11.3.0
checking whether the C compiler works... no
configure: error: in `/var/folders/rl/lvppm_c564j3rlh3hyhddh680000gn/T/ruby-build.20120222000523.27004/ruby-1.9.3-p125':
configure: error: C compiler cannot create executables

The upgraded macbook ran just fine with the rbenv install 1.9.3-p125 command.


Fixed @ 45d4277. Tested with XCode 4.4 toolchain.

@jeremy jeremy closed this

Installed head version of ruby-build w/ command-line-tools. It works only after setting CC env var, like mentioned before.


Indeed, require_gcc also exports CC - this should be revisited.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.