Support for multiple compilers (gcc and clang for now) #87

Closed
wants to merge 2 commits into
from

Projects

None yet

6 participants

@lloeki
Contributor
lloeki commented Nov 7, 2011

Xcode 4.2 dropped gcc, but ruby generally compiles just fine with clang. So I added multiple compiler support in order to add clang as a possible compiler, as a fallback to gcc. This way it is no longer necessary to install a third party gcc when one has Xcode 4.2.

To that end I added a require_cc stanza, while keeping the require_gcc one. Also, I updated two definitions to use require_cc (since those are the ones I use daily).

Possible improvement: the require_cc stanza could be updated to include a definition's supported compilers as arguments. require_gcc could e.g then theoretically become require_cc gcc if one cares less about the extra error message.

lloeki added some commits Nov 7, 2011
@lloeki lloeki Multiple compiler support
Added clang as fallback for GCC if using require_cc, particularly
useful for Mac OS X and Xcode 4.2. require_gcc still mandates gcc.
a15aa7f
@lloeki lloeki Modified requirements for 1.8.7-p352 + 1.9.2-p290
Did not modify other definitions since I did not test them
for compatibility with clang.
e19dd34
@lloeki
Contributor
lloeki commented Nov 7, 2011

My bad: 1.8.7 segfaults on gem inside timeout.rb when compiled with clang.

@jeremy
Collaborator
jeremy commented Nov 7, 2011

trunk still has issues with clang as well: http://redmine.ruby-lang.org/issues/5580

@prathe
prathe commented Nov 8, 2011

@lloeki I've tried your branch and it was able to detect the new LLVM compiler. I have XCode 4.2 without XCode 4.1. Thanks.

@sstephenson
Collaborator

@prathe @lloeki Clang/LLVM still aren't safe for building MRI; see @jeremy's link above.

@prathe
prathe commented Nov 8, 2011

@sstephenson True, make test was failing on all ruby compilation I've tried with Clang for version 1.9.2 and older. I didn't get any error though while using them. Thanks for the warning.

@lloeki
Contributor
lloeki commented Nov 9, 2011

@prathe do 1.9.3-p0 tests pass when using clang?

Anyway, e19dd34 is a bad idea to merge but I suppose a15aa7f could still be pulled since it simply provides alternate compiler support without forcing definitions to use it.

@prathe
prathe commented Nov 10, 2011

@lloeki No, 1.9.3-p0 didn't passes the tests.

@prathe
prathe commented Nov 10, 2011

@lloeki But the tests passed on the trunk (a5fc87bd5b)

9775 tests, 2208871 assertions, 0 failures, 0 errors, 46 skips
@tcurdt
tcurdt commented Dec 15, 2011

Probably still too soon but I am looking forward for this one to get merged.

@randysecrist

+1 for merging this. Would prefer to use clang over legacy gcc.

@jeremy
Collaborator
jeremy commented Mar 20, 2012

Anyone interested in revisiting this? Needs an update for XCode 4.3/4.4 and should only allow clang on 1.9.3-p125 and later.

@sstephenson
Collaborator

I think we're just going to rely on $CC here for Ruby versions that can be built with non-GCC compilers.

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