Recently I tried to compile erlang from source on my El Captain. Have done it before a bunch of times, but I wanted to test some new features on their new 19-rc1 release so I downloaded and tried to follow the readme. One thing though that is really mandatory for me, is the I must compilation with all the apps that erlang ships. Which turned out to be a little headache.
First step: configure
At first we need to configure our environment to check everything that we can do. Luckily Erlang has a nice command line tool that helps we check our environment and set all environment variables before we get started. So after download the source code, just type
$ ./otp_build autoconf and we will have a nice set of configuration option to start with.
After that command we will gain a 'configure' command that is the command that will actually check all our dependencies. So just run
$ ./configure and wait for it.
At the end of the execution we may have a couple of problems. In my case I have with two libraries,
odbc with erros like
ODBC library - link check failed. For crypto to works fine we need to install and link openssl properly. Using brew just makes sure you have the latest version of openssl
$ brew update
$ brew install openssl
Then we need to link open ssl. Once we may have some linked files that conflicts with us we need to pass the
$ brew link openssl --force
Crypto must be fine by now. We then need to configure odbc which I found a bit trickier, once it was not a problem in the past. First install
unixodbc then some installation paths by using
$ brew install unixodbc
$ odbc_config --libs # -L/usr/local/Cellar/unixodbc/2.3.4/lib -lodbc $ odbc_config --include-prefix # /usr/local/Cellar/unixodbc/2.3.4/include
Those two configurations paths we will be using to configure our installation again with the flags
LDFLAGS So just type on the configure phase something similar to this (depending on your output):
$ ./configure CFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib -lodbc"
After a coupe of minutes your environment must be ok for the newest erlang version compiled directly from source. So now you just need to continue with the basic
sudo make install.