如何在Ubuntu Karmic上安装LFE?

5

Erlang 已经安装:

$dpkg -l|grep erlang
ii  erlang                          1:13.b.3-dfsg-2ubuntu2            Concurrent, real-time, distributed function
ii  erlang-appmon                   1:13.b.3-dfsg-2ubuntu2            Erlang/OTP application monitor
ii  erlang-asn1                     1:13.b.3-dfsg-2ubuntu2            Erlang/OTP modules for ASN.1 support
ii  erlang-base                     1:13.b.3-dfsg-2ubuntu2            Erlang/OTP virtual machine and base applica
ii  erlang-common-test              1:13.b.3-dfsg-2ubuntu2            Erlang/OTP application for automated testin
ii  erlang-debugger                 1:13.b.3-dfsg-2ubuntu2            Erlang/OTP application for debugging and te
ii  erlang-dev                      1:13.b.3-dfsg-2ubuntu2            Erlang/OTP development libraries and header
[... many more]

Erlang似乎可以正常工作:

$ erl
Erlang R13B03 (erts-5.7.4) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.7.4  (abort with ^G)
1> 

我从Github下载了LFE并检出了0.5.2版本:

git clone http://github.com/rvirding/lfe.git
cd lfe
git checkout -b local0.5.2 e207eb2cad

$ configure
configure: command not found

$ make
mkdir -p ebin
erlc -I include -o ebin -W0 -Ddebug +debug_info src/*.erl
#erl -I -pa ebin -noshell -eval -noshell -run edoc file src/leex.erl -run init stop
#erl -I -pa ebin -noshell -eval -noshell -run edoc_run application "'Leex'" '"."' '[no_packages]'
#mv src/*.html doc/

一定是我漏掉了什么愚蠢的东西 :o
$ sudo make install
make: *** No rule to make target `install'.  Stop.

$ erl -noshell -noinput -s lfe_boot start
{"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 ()

有没有一个示例,我可以创建一个hello world源文件,并编译和运行它?

1个回答

7
不,你没有错过什么。LFE中的Makefile不完美应该被忽略,它将在下一个版本中得到改进。为了弥补这个问题,所有必需的文件已经编译好了,.beam文件位于ebin目录中。由于它不是OTP的一部分,我认为它永远不应该安装在那里。
处理这个问题最简单的方式是创建一个私有的erlang库目录,并将环境变量ERL_LIBS指向它。然后只需将整个LFE目录放在那里。当erlang启动时,代码服务器将自动将lfe/ebin目录添加到路径中,并且那里的.beam文件将自动被找到和加载。这适用于任何包含ebindirectory的软件包。这在Windows上也可以使用。所以:
  1. 创建libs目录,如~/erlang/lib
  2. 设置环境变量ERL_LIBS,export ERL_LIBS=~/erlang/lib
  3. 把整个LFE目录放到那里
当您启动erlang时,您将看到/Users/rv/erlang/lib/lfe/ebin(或者您放置它的位置)在代码路径中(code:get_path())。然后您也能够直接启动LFE shell。
erl -noshell -noinput -s lfe_boot start

未来还将包括一个名为lfelfe.bat的文件,用于执行此操作。

与erlang一样,任何文本编辑器都可以用来编辑LFE。对于emacs,有一个LFE模式,它仍然相当基础但可用。您还不能在窗口中运行LFE。不久之后会支持。最好的方法是将以下内容放入您的.emacs文件中:

;; LFE mode.
(setq load-path (cons "/Users/rv/erlang/lib/lfe/emacs" load-path))
(require 'lfe-start)

lfe/examples目录下有一些示例文件,它们都应该可以正常运行。在lfe/test/visual目录下有一堆我的测试文件,这些文件已经被包含在示例文件中了。如果要从普通的erlang shell编译一个LFE文件,请执行以下操作:

lfe_comp:file("foo").
l(foo).                 %No autloload here, do this to ensure loading

当从LFE shell执行以下操作:

(c '"foo")              ;This will autoload

lfe/docs 中有许多关于IT技术的文档,其中很准确,但 user_guide.txt 需要扩展。此外,还有一个 LFE 的 Google 群组。

http://groups.google.se/group/lisp-flavoured-erlang

这里有一些有趣的讨论,人们已经在Github LFE Wiki中写了很多东西。

就这些了。如果您有更多问题,请随时联系我。


非常感谢您的指导。- karlthorwald - 又名 - user89021

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接