3

每个人。

我有一个打包的erlang应用程序rebar generate

这是我的 reltool.config:

{sys, [
   {lib_dirs, ["../../..", "../../deps"]},
   {erts, [{mod_cond, derived}, {app_file, strip}]},
   {app_file, strip},
   {rel, "collector", "1",
    [
     kernel,
     stdlib,
     sasl,
     collector
    ]},
   {rel, "start_clean", "",
    [
     kernel,
     stdlib
    ]},
   {boot_rel, "collector"},
   {profile, embedded},
   {incl_cond, exclude},
   {excl_archive_filters, [".*"]}, %% Do not archive built libs
   {excl_sys_filters, ["^bin/.*", "^erts.*/bin/(dialyzer|typer)",
                       "^erts.*/(doc|info|include|lib|man|src)"]},
   {excl_app_filters, ["\.gitignore"]},
   {app, sasl,   [{incl_cond, include}]},
   {app, stdlib, [{incl_cond, include}]},
   {app, kernel, [{incl_cond, include}]},
   {app, lager, [{incl_cond, include}]},
   {app, goldrush, [{incl_cond, include}]},
   {app, meck, [{incl_cond, include}]},
   {app, mnesia, [{incl_cond, include}]},
   {app, collector, [{incl_cond, include}, {lib_dir, ".."}]}
  ]}.

{target_dir, "collector"}.

{overlay, [
           {mkdir, "log/sasl"},
           {copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
           {copy, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"},
           {copy, "files/collector", "bin/collector"},
           {copy, "files/collector.cmd", "bin/collector.cmd"},
           {copy, "files/start_erl.cmd", "bin/start_erl.cmd"},
           {copy, "files/install_upgrade.escript", "bin/install_upgrade.escript"},
           {copy, "files/sys.config", "releases/\{\{rel_vsn\}\}/sys.config"},
           {copy, "files/vm.args", "releases/\{\{rel_vsn\}\}/vm.args"}
          ]}.

编译和打包时一切顺利:

但是当我运行该应用程序时,它无法启动:

./bin/collector console

错误输出:

Exec: /home/crackcell/repo/github/shiyan/collector/rel/collector/erts-5.10.3/bin/erlexec    -boot /home/crackcell/repo/github/shiyan/collector/rel/collector/releases/1/collector -mode embedded -config    /home/crackcell/repo/github/shiyan/collector/rel/collector/releases/1/sys.config -args_file /home/crackcell/repo/github/shiyan/collector/rel/collector/releases/1/vm.args -- console
Root: /home/crackcell/repo/github/shiyan/collector/rel/collector
Erlang R16B02 (erts-5.10.3) [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]

15:34:40.547 [error] CRASH REPORT Process <0.284.0> with 0 neighbours exited with reason: call to undefined function erl_syntax:atom(module) in application_master:init/4 line 133
15:34:40.548 [info] Application lager exited with reason: call to undefined function erl_syntax:atom(module)
{"Kernel pid terminated",application_controller,"{application_start_failure,lager,   {bad_return,{{lager_app,start,[normal,[]]},{'EXIT',{undef,[{erl_syntax,atom,[module],[]},{glc_code,abstract_module_,2,[{file,\"src/glc_code.erl\"},{line,52}]},{glc_code,abstract_module,2,[{file,\"src/glc_code.erl\"},{line,39}]},{glc_code,compile,2,[{file,\"src/glc_code.erl\"},{line,29}]},{glc,compile,2,[{file,\"src/glc.erl\"},{line,171}]},{lager_util,trace_filter,2,[{file,\"src/lager_util.erl\"},{line,366}]},{lager_app,start,2,[{file,\"src/lager_app.erl\"},{line,116}]},{application_master,start_it_old,4,[{file,\"application_master.erl\"},{line,269}]}]}}}}}"}

Crash dump was written to: erl_crash.dump

内核 pid 终止 (application_controller) ({application_start_failure,lager,{bad_return,{{lager_app,start,[normal,[]]},{'EXIT',{undef,[{erl_syntax,atom,[module],[]} ,{glc_code,abstract_module_,2

似乎主要原因是{'EXIT',{undef,[{erl_syntax,atom,[module],[]} 但我不知道为什么它未定义(我可以在控制台中手动使用它)或如何解决它。

顺便说一句,我使用 Erlang R16B02。

任何人都可以帮助我吗?谢谢。

4

1 回答 1

7

erl_syntax 是 syntax_tools 的一部分(而不是 erl_parse 可用的 stdlib)。您需要在钢筋配置中明确添加它,以将其作为收集器版本的一部分。

{app, syntax_tools, [{incl_cond, include}]},

请注意,rebar.config 中指定的任何内容都会复制到发布文件夹中,并且不会引用已安装的 Erlang 发布。因此需要显式添加许多工具。

于 2013-10-05T10:18:04.140 回答