3
votes

Does Lisp Flavored Erlang (LFE) work on Windows? I am using LFE 0.6/Erlang 5.8.2/Windows 7 32-bit. I copied the lfe shell script as a batch file (replacing $@ with %1 %2 %3 %4) and it gives me this:

D:\projects\checkout\lfe>lfe
{"init terminating in do_boot",{undef,[{lfe_boot,start,[]},{init,start_it,1},{init,start_em,1}]}}

Crash dump was written to: erl_crash.dump
init terminating in do_boot ()
2

2 Answers

3
votes

The problem here is that Erlang can't find the LFE ebin directory. Two ways to solve this problem are:

  • Use an explicit -pa <lfe ebin dir> argument when starting LFE, either in the lfe.bat script or when you call it. Simple but hard wired.

  • Use the ERL_LIBS environment variable. This is described in the code module documentation, http://erlang.org/doc/man/code.html. If you create an extra Erlang library directory, say c:\projects\erlang, drop Erlang apps which follow the Erlang application directory structure as LFE does, and point ERL_LIBS at it then the code server will automatically add ebin directories it finds there to its code path.

This is also described in How do I install LFE on Ubuntu Karmic? but in a UNIX context.

The ERL_LIBS feature should definitely be better advertised.

EDIT: Replying to @Shantanu Kumar's comment.

I don't have access to a Windows machine so I can't test it properly. The problem seems to be that using lfe_boot tries to start the port program ttysl which doesn't seem to work on Windows, at least not when running erl.exe. Some solutions to try:

  • Use werl.exe instead. This may work, but I would do it anyway.

  • Try starting Erlang in the normal way with werl.exe -pa ebin (to get the right load path) and manually starting the LFE shell with lfe_shell:server().

  • Try starting Erlang with werl.exe -pa ebin -noshell -s lfe_shell start. This will run lfe_shell as the shell but the ^G won't be available.

Also while it is nice to use it you don't need to use the LFE shell to run LFE, you can use the normal Erlang shell and just call the LFE functions in the "normal" way. You might become a little schizophrenic with two io formats, but there are no problems. :-)

Hope this helps.

1
votes

My apologies; I know this post is basically dead, but I don't find other posts on the topic, thus replying here seems appropriate.

I believe I've found a methodology that works. Very simple really: just use MSYS2 and Mingw-w64 to build LFE, then run it from the build directory via ./bin/lfe.

There's one tweak needed it seems: the last line of bin/lfe seems to require a tweak to call "werl" instead of "erl". Honestly I don't know why this is; I'm too green behind the ears with Erlang to say why.

I've also documented this with slightly more detail on my personal blog: http://www.vultaire.net/blog/2016/05/02/installing-lisp-flavored-erlang-on-windows/

Hope this helps someone out!