set --with-gcc=gcc-4.2 on lion + xcode 4.1 #40

Merged
merged 1 commit into from Sep 16, 2011

5 participants

@jeremy

The CC export works, but may as well follow the recommendation in ruby/ruby@9151ed2

(Could replace the CC export, even)

@sstephenson sstephenson merged commit c729320 into rbenv:master Sep 16, 2011
@sstephenson

Looks good. Eventually we should replace the use_gcc42_on_lion function with something that detects whether or not you're using Xcode 4.1 or 4.2.

@josh
$ ls -al /usr/bin/gcc
lrwxr-xr-x  1 root  wheel    12B Jul 20 11:27 /usr/bin/gcc@ -> llvm-gcc-4.2

IIRC, on Leopard thats symlinked to just gcc-4.2.

@josh

Or

$ gcc -v 2>&1 | tail -n1 | grep LLVM
@sstephenson

The issue is that Xcode 4.2 doesn't ship with gcc at all.

@josh
$ /usr/bin/gcc-4.2 -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/gcc/gcc-5666.3~353/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)

Do I have this since I installed 4.1 at on point?

@sstephenson

I think so. I can't find it documented anywhere except here:
http://www.macruby.org/trac/ticket/1382
Homebrew/legacy-homebrew#7254

@josh

1.9.x should work fine on llvm-gcc. Its only 1.8 that has issues. Think we could just tweak to method to be requires_old_school_gcc and raise an error if its not on your system.

@sstephenson

I thought 1.9.x was fine with LLVM too, but apparently not: #37

I think @jeremy said 1.9.3 is the first LLVM-safe version.

@jeremy

1.9.2-dev isn't supported on Lion at all until http://redmine.ruby-lang.org/issues/5074 is backported.

1.9.x isn't supported on LLVM until a recent (post-preview1) 1.9.3, and even then only with recent LLVM. XCode 4.1 doesn't work.

On XCode 4.2, clang 3.0 builds 1.9.3-dev and trunk for me. See ruby/ruby@ddcb133#commitcomment-571267

👍 to old-school GCC until ruby-core works out the kinks with LLVM.

@cavneb

Has there been any progress on this front? I can't install 1.8.7 either b/c it doesn't accept the standard llvm-gcc-4.2 to compile. Thanks for your hard work on this!

@mkosma

What a pain, but I seem to have 1.8.7 working.

You can install gcc-4.2 by downloading and installing Xcode 4.1 from the apple developer site. Do a tail -f on /var/log/install.log while doing it; looks like if it finds traces of the Xcode 4.2 install or even installer, you can't go back to 4.1. Not sure this is the only option or the best option, but at least I was able to get Lion with a working gcc-4.2.

Here's what I had to do:
1. remove xcode 4.2 by running /Developer/Library/uninstall-devtools
2. spotlight search for Install Xcode.app and get rid of it
3. download and install Xcode 4.1 for Lion
4. rvm uninstall 1.8.7 (my prior non-working install)
5. rvm remove all
6. rvm get latest
7. rvm install 1.8.7
8. gem update --system

finally, good to go!

@cavneb

I actually found an even easier way to get it working without re-installing xcode. I installed this and then it worked:

https://github.com/kennethreitz/osx-gcc-installer

Good times :D

@mkosma

Excellent. where were you at 4am when I needed you? :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment