gcc and homebrew on Mountain Lion

I’m trying to get B2G built, and one of the steps on OS X is to install gcc (this install is all automated in the bootstrap script).

I am on a (relatively) clean install of Mountain Lion.

Unfortunately during the bootstrap, installation of the gcc dependency mpfr fails:

clang: error: unable to execute command: Segmentation fault: 11
clang: error: linker command failed due to signal (use -v to see invocation)
make[2]: *** [libmpfr.la] Error 254
make[1]: *** [all] Error 2
make: *** [all-recursive] Error 1
config.log was copied to /Users/me/Library/Logs/Homebrew
==> Exit Status: 2
==> Build Environment
HEAD: 523a7a6fce7e934a55069c7cec8e2ba3e0e5f4c2
CPU: quad-core 64-bit arrandale
OS X: 10.8.2-x86_64
Xcode: 4.5
X11: N/A
CC: cc
CXX: c++
CMAKE_INCLUDE_PATH: /usr/include/libxml2:/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers/
CMAKE_LIBRARY_PATH: /System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries
PKG_CONFIG_PATH: /usr/local/Library/Homebrew/pkgconfig
ACLOCAL_PATH: /usr/local/share/aclocal
PATH: /usr/local/Library/ENV/4.3:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Error: Failed executing: make (mpfr.rb:31)

This link will help resolve the above errors:

Reading through the checklist didn’t help much, and googling for clang segmentation faults wasn’t much help either.

From Get Mountain Lion and Homebrew Happy, I read that forcibly saying where your Xcode install is would assist:

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

… but this does not fix it. I also noted the option to force gcc use instead of llvm, so I tried:

brew install mpfr –use-gcc

This worked, and allowed mpfr to build and install. 

I was then able to complete the gcc install:

brew install gcc-4.6

… and I’m now apparently good to go:

Found Xcode: /Applications/Xcode.app
Found Mac OS X 10.7 SDK: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk
Found git: /usr/local/bin/git
Found gpg: /usr/local/bin/gpg
Found ccache: /usr/local/bin/ccache
Found yasm: /usr/local/bin/yasm
Found autoconf-2.13: /usr/local/bin/autoconf213
Warning: gcc reports version i686-apple-darwin11-llvm-gcc-4.2, will look for gcc-4.6
Found gcc-4.6: /usr/local/bin/gcc-4.6
Congratulations, you are now ready to start building Boot2Gecko!
For more details, see our documentation:


I’ve updated the Mozilla wiki page with this hack accordingly. I now need to figure out if it’s appropriate to add it to the bootstrap script…

Onward and upward!

This entry was posted in Computing, Mobile Tech, Planet, Research and tagged , , , , , , , . Bookmark the permalink.