如何在 Ubuntu Karmic 上安装 LFE?

发布于 2024-09-01 10:09:52 字数 1921 浏览 3 评论 0原文

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 源文件并编译和运行它?

Erlang was already installed:

$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 seems to work:

$ 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> 

I downloaded lfe from github and checked out 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/

Must be something stupid i missed :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 ()

Is there an example how I would create a hello world source file and compile and run it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浅暮の光 2024-09-08 10:09:52

不,你没有错过任何东西。 LFE 中的 Makefile “不够完美”,应该被忽略,它将在下一个版本中得到改进。作为补偿,所有需要的文件都已编译,并且 .beam 文件位于 ebin 目录中。由于它不是 OTP 的一部分,我认为它不应该安装在那里。

处理这个问题的最简单方法是创建一个私有的 erlang 库目录并将环境变量 ERL_LIBS 指向它。然后将整个 LFE 目录拖到那里。当erlang启动时,代码服务器会自动将lfe/ebin目录添加到路径中,并且会自动找到并加载其中的.beam文件。这适用于任何包含 ebin 目录的包。这也适用于 Windows。所以:

  1. 创建一个libs目录,比如~/erlang/lib
  2. 设置环境变量ERL_LIBS,export ERL_LIBS=~/erlang/lib
  3. 将整个LFE目录放在那里

当你开始时然后,您将在代码路径 (code:get_path()) 中看到 /Users/rv/erlang/lib/lfe/ebin (或任何有它的地方)。然后,您还可以直接启动 LFE shell,将来

erl -noshell -noinput -s lfe_boot start

也会有一个 lfe 和一个 lfe.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 中有一堆文档,非常准确,但 user_guide.txt 需要扩展。还有一个针对 LFE 的 Google 小组,其中

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

包含一些有趣的讨论,并且人们在 github LFE wiki 中写了很多内容。

我想就是这样。如果/当您有更多问题时请联系我。

No, there is nothing you missed. The Makefile in LFE is "less than perfect" and should be ignored, it will be improved upon in the next release. To compensate all the needed files have already compiled and the .beam files are in the ebin directory. As it is not part of OTP I don't think it should ever install there.

The easiest way to handle this to create a private erlang library directory and point the environment variable ERL_LIBS to it. Then just drop the whole LFE directory there. When erlang starts the code server will automatically add the lfe/ebin directories into the path and the .beam files there will automagically be found and loaded. This will work with any package that contains an ebin directory. This also works on Windows. So:

  1. Make an libs directory, say ~/erlang/lib
  2. Set the environment variable ERL_LIBS, export ERL_LIBS=~/erlang/lib
  3. Put the whole LFE directory there

When you start erlang you will then see /Users/rv/erlang/lib/lfe/ebin (or wherever you have it) in the code path (code:get_path()). You will then also be able to start the LFE shell directly with

erl -noshell -noinput -s lfe_boot start

There will be an lfe and an lfe.bat which does this included as well in the future.

As with erlang any text editor will work to edit LFE. For emacs there is an LFE mode which is still rather basic but works. You cannot yet run LFE in a window. Soon. The best way to include this is to put the following in your .emacs file:

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

There are some example files in lfe/examples, all should work. In lfe/test/visual there is a bunch of my test files which have been included as example files. To compile an LFE file from the normal erlang shell do

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

while from the LFE shell do:

(c '"foo")              ;This will autoload

There is a bunch of documentation in lfe/docs which is quite accurate but the user_guide.txt needs to be extended. There is also a Google group for LFE at

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

which contains some interesting discussions and people have written quite a lot in the github LFE wiki.

That's about it I think. contact me if/when you have more questions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文