Problem
When compiling ruby on a colleague’s OSX machine for a legacy project, we ran into the following error:
C compiler cannot create executables
1 2 3 4 5 |
|
Background
The reason for this is that Apple doesn’t bundle gcc for newer versions of Xcode, but instead bundles llvm-gcc. llvm-gcc is mostly compatible with gcc, but not completely [unverified source: doesn’t compile gcc itself].
Solution
You can easily install gcc-4.2 via homebrew dupes:
1 2 |
|
(source: https://coderwall.com/p/lqpp8w)
And then run
1
|
|
Additional resources
- the rbenv issue itself is documented on github
- the gcc vs. xcode situation is discussed on Hacker News
- we also found instructions for building gcc from source on Caius Theory