如何在 Ubuntu Karmic 上安装 LFE?
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,你没有错过任何东西。 LFE 中的 Makefile “不够完美”,应该被忽略,它将在下一个版本中得到改进。作为补偿,所有需要的文件都已编译,并且 .beam 文件位于
ebin
目录中。由于它不是 OTP 的一部分,我认为它不应该安装在那里。处理这个问题的最简单方法是创建一个私有的 erlang 库目录并将环境变量 ERL_LIBS 指向它。然后将整个 LFE 目录拖到那里。当erlang启动时,代码服务器会自动将
lfe/ebin
目录添加到路径中,并且会自动找到并加载其中的.beam文件。这适用于任何包含 ebin 目录的包。这也适用于 Windows。所以:~/erlang/lib
export ERL_LIBS=~/erlang/lib
当你开始时然后,您将在代码路径 (
code:get_path()
) 中看到/Users/rv/erlang/lib/lfe/ebin
(或任何有它的地方)。然后,您还可以直接启动 LFE shell,将来也会有一个
lfe
和一个lfe.bat
来执行此操作。与 erlang 一样,任何文本编辑器都可以编辑 LFE。对于 emacs,有一个 LFE 模式,它仍然相当基本但有效。您还不能在窗口中运行 LFE。很快。包含此内容的最佳方法是将以下内容放入您的 .emacs 文件中:
lfe/examples
中有一些示例文件,所有这些都应该可以工作。在lfe/test/visual
中有一堆我的测试文件,它们已作为示例文件包含在内。要从普通 erlang shell 编译 LFE 文件,请在 LFE shell 中执行以下操作:
lfe/docs
中有一堆文档,非常准确,但user_guide.txt
需要扩展。还有一个针对 LFE 的 Google 小组,其中包含一些有趣的讨论,并且人们在 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:~/erlang/lib
export ERL_LIBS=~/erlang/lib
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 withThere will be an
lfe
and anlfe.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:
There are some example files in
lfe/examples
, all should work. Inlfe/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 dowhile from the LFE shell do:
There is a bunch of documentation in
lfe/docs
which is quite accurate but theuser_guide.txt
needs to be extended. There is also a Google group for LFE atwhich 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.