I’ve updated to the shiny new OS from Apple and I needed to use the language of the devil–Erlang. Unfortunately, there was no binary package for OS X, so I needed to compile it from the sources.
If you need to do the same yourself, you will need XCode 4.1 (get it for free in the App Store). This installs, amongst others, LLVM build 2335.15.00 gcc. Unfortunately, LLVM build 2335.15.00 is too new to build Erlang and the build fails. I did not want to install older gcc, but there is a simpler solution.
First make sure you’re running these commands on freshly untarred sources. It is not enough to run make clean, the Erlang’s makefile does not clean up everything properly. Now, once you’re in the directory where you uncompressed Erlang’s sources, run (notice setting the CFLAGS environment variable)
otp-sources $ CFLAGS=-O0 ./configure --prefix=/usr/share/erlang \ --enable-threads --enable-darwin-64bit
This will prepare the makefile for your platform; to compile & install simply run
make ; sudo make install
To complete the configuration of your system, you may want to consider adding entries to /etc/profile
ERLANG_HOME=/usr/share/erlang PATH=…:$ERLANG_HOME/bin

brew install erlang
I’d never have guessed this was an optimization flag. Thanks for posting this.