This writeup documents the process I used to install Erlang 18.3 on a Beglebone Black, building for ARM (armv71) architecture.
The Beaglebone has Debian Wheezy installed, 7.9, from the latest Wheezy image available on the beaglebone site at the time I set it up. I had a terrible time getting Jessie to install cleanly, and I recommend you avoid it for now (may write about those woes elsewhere).
Debian 7.9 (BeagleBone, BeagleBone Black, Seeed BeagleBone Green – 4GB SD) 2015-11-12 sha256sum: f6e67ba01ff69d20f2c655f5e429c3e6c2398123bcd3d8d548460c597275d277
First off, I do this via the serial console, so that I can see all the good stuff that may end up there as the system runs. Plenty of ways to connect, like using a standard 3.3V FTDI cable and the
screen command. Handy tip – figure out the rows/cols size of your terminal window, and then throw them into this command to get everything sized right:
[email protected]:~# stty cols 150 rows 70
The rest of this is written assuming you are logged in as root.
The Debian image provided on the Beagleboard site has most of the deps already in place, but we need to install the
ncurses development files. Also, due to use of newer atomic operations constructs, we need gcc 4.7 to avoid performance issues.
[email protected]:~# apt-get install libncurses5-dev [email protected]:~# apt-get install gcc-4.7 [email protected]glebone:~# apt-get install g++-4.7
After installing gcc 4.7, it will be living along side version 4.6, so we need to switch things around. The
update-alternatives command takes care of symlinking and stuff for us:
[email protected]:~# update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6 [email protected]:~# update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.7 [email protected]:~# update-alternatives --config gcc [email protected]:~# gcc --version gcc (Debian 4.7.2-5) 4.7.2
Excellent, the gcc link now points at the correct version.
Building Erlang 18.3
Download the source tarball from the Erlang downloads page, unpack it, delete the tarball to save some space, and jump in:
[email protected]:~# wget http://erlang.org/download/otp_src_18.3.tar.gz [email protected]:~# tar -xvf otp_src_18.3.tar [email protected]:~# rm otp_src_18.3.tar [email protected]:~# cd otp_src_18.3/
The next steps are from the Erlang build instructions. You should read that page before you proceed, so you can tweak your build to suit your needs.
[email protected]:~/otp_src_18.3# export ERL_TOP=`pwd` [email protected]:~/otp_src_18.3# ./configure ...lots of configure output, make sure it looks good... [email protected]:~/otp_src_18.3# make ...lots of make output, make sure it looks good... ...grab coffee... ...maybe lunch... [email protected]:~/otp_src_18.3# make release_tests ...and more building, not quite as long... ...refill the coffee...
Testing Your Erlang Build
Always good to run the tests when available, and especially when building for a less-common platform. Again, these command still come from the Erlang build docs linked above.
[email protected]:~/otp_src_18.3# cd release/tests/test_server [email protected]:~/otp_src_18.3/release/tests/test_server# $ERL_TOP/bin/erl -s ts install -s ts smoke_test batch -s init stop ...runs tests, get more coffee...
Finally we need to check the results of the tests. These are delivered up in a nice interactive HTML page, which would be unfortunate to read on a text console. So, let’s toss a link into the www directory and tweak permissions, then we can see it in a graphical browser over the network.
[email protected]:~# ln -s /root/otp_src_18.3/release/tests/test_server /var/www/erlang [email protected]:~# chmod 755 /root
You may want to
chmod 700 /root when you are done. You can now access the test results at
http://YOUR_BBB_IP_HERE:8080/erlang/ – look them over carefully.
A few tests failed for me. Three in the time suite,
consistency. Apparently these only work if the system running them is set to CET timezone where the main Erlang build box lives, and where I don’t live, so no worries here. Also,
t_gethostnative in inet suite failed, but reading the test case code it seems to check some odd Windows behaviour. When I test the call by hand in an erl shell, it works fine. Meh, good enough!
This is as easy as can be:
[email protected]:~/otp_src_18.3# make install ...lots of make install output here, look it over to see if it worked...
[email protected]:~# erl Erlang/OTP 18 [erts-7.3] [async-threads:10] [hipe] [kernel-poll:false] Eshell V7.3 (abort with ^G) 1> io:format("It Lives!~n"). It Lives! ok
Enjoy your fresh new version of Erlang on Beaglebone Black!