Tuesday, 13 December 2011

Error building Erlang on Lion using Macports

Macports was hanging during my install of the rabbitmq-server port. Running port -v showed me that an error was occurring during Erlang compilation (RabbitMQ is writtien in Erlang). The issue, it seems to due to the optimisation settings used by llvm-gcc-4.2. The solution is to patch the Erlang Portfile. Edit:
/opt/local/var/macports/sources/rsync.macports.org/release/ports/lang/erlang/Portfile
Search for:
if {${configure.compiler} == "clang"} { 
    configure.compiler llvm-gcc-4.2 
} 
And insert the following directly below it:
configure.cflags-delete "-std=c99"
configure.cflags-delete -O2
configure.cxxflags-delete -O2
configure.cflags-append -O0
configure.cxxflags-append -O0
Save the file and then re-run the port install.