1

I am familiar with building erlang releases with rebar. Now I am trying out packaging releases with relx.

I build the code with erlang.mk. I have a relx.config that lists the applications I want to bundle. The command

./relx -o rel/myrel

succeeds.

However, starting the release fails and crashes:

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,[]]}}})

This looks like the release can't find prim_inet:open/2 - either because its including application hasn't been started, or because it doesn't have the right paths.

I've tried listing inets (and other applications) in relx.config. No effect.

From the relx logs, it seems to know about my erlang libs (in /usr/local/lib/erlang/lib).

Can anyone help me work out what I'm missing and how I can make the above release work?

update: the ERL_LIBS directory above is not created. Meanwhile, the apps I specified are all in myrel/lib/. So something is clearly up.

With thanks and best wishes

Ivan

Ivan Uemlianin
  • 953
  • 7
  • 21
  • `prim_inet` is part of the `erts` library that is not included. P.S I could have simply reproduced it. looks like relx cannot include the `erts` library, even if I specify it as a dependency, relx says it's not reachable by the system. –  Feb 04 '14 at 13:04
  • Thanks! Good clue. nb the relx documentation says erts is included by default. I'll see what I can do with this. – Ivan Uemlianin Feb 04 '14 at 13:38
  • yeah, `erts` from `/usr/local/lib/erlang/erts-[vsn]` is included for me, but `prim_inet` is placed in `/usr/local/lib/erlang/lib/erts-[vsn]` –  Feb 04 '14 at 13:41
  • Yes I see it. We might be close to an answer. – Ivan Uemlianin Feb 04 '14 at 13:46
  • I found an unfancy way to include `lib/erts-[vsn]`. you can use the configuration `{overlay, [{copy, source, destination}]}` like this: `{overlay, [{copy, "/path/to/erlang/lib/erts-[vsn]", "{{output_dir}}/lib/erts-[vsn]"}]}.` –  Feb 04 '14 at 14:34
  • Thanks. I had tried an even more unfancy method - just cp -R the directory over. No effect I'm afraid. Have you had success with relx? – Ivan Uemlianin Feb 04 '14 at 14:50
  • upgraded my erlang to 16 (from 15). Now have a different set of errors. Thanks for your help. Post something as an answer and I'll accept it:) – Ivan Uemlianin Feb 04 '14 at 15:44

1 Answers1

2

I have the same problem on R15B03, relx 0.6.0

I noticed that prim_inet is placed in /path/to/erlang/lib/erts-[vsn] (which has no application resource file, so it cannot be specified as a dependency) but relx includes /path/to/erlang/erts-[vsn]

Seems like a bug that we should report it on the relx issue tracker.