Dinky Red Panda is the personal site of Stephen Allred

Brew, Xcode 4, LLVM and the GCC

Saturday, June 18, 2011

Xcode 3 shipped with the GCC as the default C/C++ compiler on Mac OS X. Xcode 4, however, shipped with the shinny new LLVM as the default compiler, with all the good stuff it brings. Unfortunately, especially during the Xcode 4 beta, not all Unix packages would successfully compile with LLVM. If you used Homebrew as your package manager this could cause problems, as by default brew uses the system default compiler for building packages. When I bumped into this problem during the Xcode 4 beta (I believe a version of postgres would not build with LLVM at the time, but don't quote me on it), I checked the brew install command's flags:

--use-llvm

was present to force building with LLVM, but there was no option to for forcing the GCC to be used. So, with this commit to Homebrew, I added the

--use-gcc

install command flag. If you come across a package the doesn't build in LLVM, you can use the flag fall back on forcing it to build with the GCC.

Enjoy!

Golem

Automated bot.