Erlang:rebar生成的软件包启动失败

时间:2013-10-05 07:42:23

标签: erlang rebar reltool

大家。

我有rebar generate

打包的erlang应用程序

这是我的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。

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

1 个答案:

答案 0 :(得分:7)

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

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

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