Installing Lisp Flavored Erlang on Windows

As another Erlang experiment (and as a Lisp fan), I figured I would try to give Lisp Flavored Erlang (LFE) a try. However, per my normal requirements for learning new programming languages, I had to establish that it would not only work on Linux, but also on Windows.

I searched StackOverflow and found this post which indicates at least one other person has tried to get this working, however that person was not able to do so. Attempts to find other posts on the subject on Stack Overflow met with failure.

This was a little discouraging, but the post in question was over 5 years old, so I figured I would give it a try using MSYS2 and Mingw-w64.

The good news is this: I seem to have successfully built and got LFE running on Windows. I can’t say I can get it working in the exact same method as for Linux, and not without some tweaks to the scripts provided, but nonetheless, it is possible. It’s not even really that hard. In this post I will detail how.

The procedure to build LFE on Windows is:

  1. Install MSYS2 (including the post-install steps described on their site).
  2. Additionally install the mingw64/mingw-w64-x86_64-make and mingw64/mingw-w64-x86_64-gcc packages (or the 32-bit equivalents if you prefer) into your MSYS2 environment.
  3. Ensure that Erlang is on your PATH.
    • e.g. export "PATH=/c/Program Files/erl6.2/bin:$PATH"
    • Note that the spaces in the path to Erlang are not backslash-escaped.
    • As a sanity check, run “which erl” to ensure that Erlang can be found via your PATH variable.
  4. Download the LFE sources.
  5. To build, instead of “make compile”, run “mingw32-make compile” from an MSYS2 prompt.
  6. Finally, bin/lfe needs to be updated to use werl instead of erl.
    • The last line in the file looks like: ERL_LIBS="$ALL_LIBS" exec erl "$@"
    • Change erl to werl, i.e. ERL_LIBS="$ALL_LIBS" exec werl "$@"
    • Reason: there seems to be some difference between how erl and werl work, which I do not grok at this point. However, simply put, werl will bring you to an LFE prompt, while erl will bring you to a vanilla Erlang prompt, even with the extra arguments used here.

Then, to run LFE: open an MSYS2 prompt, “cd” to the LFE directory, then run ./bin/lfe.

Here’s what it looks like, including a quick “Hello World” test:

LFE_on_Windows_w_hello_world

LFE is unmistakably running. While I don’t get the nice ANSI-colored ASCII art that I would via an ANSI terminal on startup, LFE itself appears to work fine.

Hope this post helps someone out!

2 thoughts on “Installing Lisp Flavored Erlang on Windows

Leave a Reply to Rob Herman Cancel reply

Your email address will not be published. Required fields are marked *