Windows 上 Lisp 风格的 Erlang
Lisp Flavored Erlang (LFE) 可以在 Windows 上运行吗?我使用的是 LFE 0.6/Erlang 5.8.2/Windows 7 32 位。我将 lfe shell 脚本复制为批处理文件(用 %1 %2 %3 %4 替换 $@),它给了我这个:
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 ()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这里的问题是Erlang找不到LFE ebin目录。解决此问题的两种方法是:
在启动 LFE 时使用显式
-pa
参数,无论是在lfe.bat
脚本中还是在你称之为。简单但硬连线。使用
ERL_LIBS
环境变量。code
模块文档 http://erlang 对此进行了描述。 org/doc/man/code.html。如果您创建一个额外的 Erlang 库目录,例如c:\projects\erlang
,请删除像 LFE 一样遵循 Erlang 应用程序目录结构的 Erlang 应用程序,并将ERL_LIBS
指向它那么代码服务器会自动将它找到的 ebin 目录添加到其代码路径中。如何在 Ubuntu Karmic 上安装 LFE? 但在 UNIX 上下文中。
ERL_LIBS
功能绝对应该得到更好的宣传。编辑:回复@Shantanu Kumar 的评论。
我无法访问 Windows 计算机,因此无法正确测试它。问题似乎是使用
lfe_boot
尝试启动端口程序ttysl
,该程序似乎在Windows上不起作用,至少在运行erl.exe时不起作用
。可以尝试的一些解决方案:改用
werl.exe
。这可能有效,但无论如何我都会这样做。尝试使用
werl.exe -pa ebin
以正常方式启动 Erlang(以获得正确的加载路径),并使用lfe_shell:server() 手动启动 LFE shell。
尝试使用
werl.exe -pa ebin -noshell -s lfe_shell start
启动 Erlang。这将作为 shell 运行lfe_shell
,但^G
将不可用。另外,虽然使用它很好,但您不需要使用 LFE shell 来运行 LFE,您可以使用普通的 Erlang shell,并以“正常”方式调用 LFE 函数。对于两种 io 格式你可能会变得有点精神分裂,但是没有问题。 :-)
希望这有帮助。
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 thelfe.bat
script or when you call it. Simple but hard wired.Use the
ERL_LIBS
environment variable. This is described in thecode
module documentation, http://erlang.org/doc/man/code.html. If you create an extra Erlang library directory, sayc:\projects\erlang
, drop Erlang apps which follow the Erlang application directory structure as LFE does, and pointERL_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 programttysl
which doesn't seem to work on Windows, at least not when runningerl.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 withlfe_shell:server().
Try starting Erlang with
werl.exe -pa ebin -noshell -s lfe_shell start
. This will runlfe_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.
我很抱歉;我知道这篇文章基本上已经死了,但我没有找到有关该主题的其他帖子,因此在这里回复似乎是合适的。
我相信我已经找到了一种行之有效的方法。非常简单:只需使用 MSYS2 和 Mingw-w64 构建 LFE,然后通过 ./bin/lfe 从构建目录运行它。
似乎需要进行一个调整: bin/lfe 的最后一行似乎需要调整以调用“werl”而不是“erl”。老实说我不知道这是为什么;我对 Erlang 还很陌生,无法说出原因。
我还在我的个人博客上对此进行了更详细的记录: http://www.vultaire.net/blog/2016/05/02/installing-lisp-flavored-erlang-on-windows/
希望这可以帮助别人!
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!