【发布时间】:2014-02-28 09:56:58
【问题描述】:
我熟悉使用 rebar 构建 erlang 版本。现在我正在尝试使用 relx 打包发布。
我使用 erlang.mk 构建代码。我有一个 relx.config 列出了我要捆绑的应用程序。命令
./relx -o rel/myrel
成功了。
但是,启动发布失败并崩溃:
cd rel
./myrel/bin/myrel console
Exec: /Users/ivan/tmp/rel/myrel/erts-5.9.2/bin/erlexec -boot /Users/ivan/tmp/rel/myrel/releases/1.0.0/myrel -env ERL_LIBS /Users/ivan/tmp/rel/myrel/releases/1.0.0/lib -config /Users/ivan/tmp/rel/myrel/releases/1.0.0/sys.config -args_file /Users/ivan/tmp/rel/myrel/releases/1.0.0/vm.args -- console
Root: /Users/ivan/tmp/rel/myrel
{error_logger,{{2014,2,4},{11,43,6}},supervisor_report,[{supervisor,{local,kernel_sup}},{errorContext,start_error},{reason,{'EXIT',{undef,[{prim_inet,open,[udp,inet],[]},{inet,open,7,[]},{inet_config,set_hostname,0,[]},{inet_config,init,0,[]},{inet_db,start_link,0,[]},{supervisor,do_start_child,2,[]},{supervisor,start_children,3,[]},{supervisor,init_children,2,[]}]}}},{offender,[{pid,undefined},{name,inet_db},{mfargs,{inet_db,start_link,[]}},{restart_type,permanent},{shutdown,2000},{child_type,worker}]}]}
{error_logger,{{2014,2,4},{11,43,6}},std_info,[{application,kernel},{exited,{shutdown,{kernel,start,[normal,[]]}}},{type,permanent}]}
{"Kernel pid terminated",application_controller,"{application_start_failure,kernel,{shutdown,{kernel,start,[normal,[]]}}}"}
Crash dump was written to: erl_crash.dump
Kernel pid terminated (application_controller) ({application_start_failure,kernel,{shutdown,{kernel,start,[normal,[]]}}})
这看起来好像该版本找不到 prim_inet:open/2 - 可能是因为它的包含应用程序尚未启动,或者因为它没有正确的路径。
我尝试在 relx.config 中列出 inets(和其他应用程序)。没有效果。
从 relx 日志中,它似乎知道我的 erlang 库(在 /usr/local/lib/erlang/lib 中)。
谁能帮我弄清楚我缺少什么以及如何使上述版本正常工作?
更新:没有创建上面的 ERL_LIBS 目录。同时,我指定的应用程序都在 myrel/lib/.所以显然有些事情发生了。
感谢和祝福
伊万
【问题讨论】:
-
prim_inet是不包括在内的erts库的一部分。 P.S 我本可以简单地复制它。看起来 relx 不能包含erts库,即使我将其指定为依赖项,relx 也表示系统无法访问它。 -
谢谢!好线索。注意 relx 文档说默认包含 erts。我会看看我能用这个做什么。
-
是的,来自
/usr/local/lib/erlang/erts-[vsn]的erts包含给我,但prim_inet放在/usr/local/lib/erlang/lib/erts-[vsn]中 -
是的,我明白了。我们可能已经接近答案了。
-
我发现了一种包含
lib/erts-[vsn]的奇怪方法。你可以像这样使用配置{overlay, [{copy, source, destination}]}:{overlay, [{copy, "/path/to/erlang/lib/erts-[vsn]", "{{output_dir}}/lib/erts-[vsn]"}]}.