How do I install LFE on Ubuntu Karmic?

隐身守侯 提交于 2019-12-06 04:28:08

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/2835942/how-do-i-install-lfe-on-ubuntu-karmic

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!