My project has a number of dependencies in .../deps, and two contained Erlang apps in .../apps.
rebar.config
:
{sub_dirs, ["apps/rmbrDb","apps/rmbrRest","rel"]}.
{lib_dirs, ["deps","apps"]}.
{deps, [
{webmachine, "1.10.*", {git, "git://github.com/basho/webmachine", "HEAD"}},
{riakc, ".*", {git, "git://github.com/basho/riak-erlang-client", "HEAD"}}
]}.
The project compiles (./rebar get-deps compile
) without errors, and the contained apps do produce beam files.
The offending app files look like:
{application,rmbrDb,
[{description,"Database Api for Main"},
{vsn,"0.0.1"},
{modules,[rmbrDb,rmbrDb_app,rmbrDb_sup]},
{registered,[rmbrDb_sup]},
{applications,[kernel,stdlib]},
{mod,{rmbrDb_app,[]}},
{start_phases,[]}]}.
I try to start using a shell script:
exec erl -pa $PWD/ebin $PWD/deps/*/ebin $PWD/apps/*/ebin -boot start_sasl -s reloader -s rmbrDb -s rmbrRest
Which produces:
{"init terminating in do_boot",{undef,[{rmbrDb,start,[],[]},{init,start_it,1,[]},{init,start_em,1,[]}]}}
Crash dump was written to: erl_crash.dump
init terminating in do_boot ()
The log contains
=mod:rmbrDb
Current size: 7281
Current attributes: 836C0000000...
Current compilation info: 836C0000000...
and
=fun
Module: rmbrDb
Uniq: 118638513
Index: 0
Address: 0x000000001a52b6d0
Native_address: 0x0000000017c8d370
Refc: 1
which suggests the module was loaded.
The rmbrDb_app file contains:
-module(rmbrDb_app).
-behaviour(application).
-export([start/2, stop/1]).
-spec start(normal | {takeover, node()} | {failover, node()},
any()) -> {ok, pid()} | {ok, pid(), State::any()} |
{error, Reason::any()}.
start(_StartType, _StartArgs) ->
case rmbrDb_sup:start_link() of
{ok, Pid} ->
{ok, Pid};
Error ->
Error
end.
So the start function is defined.
I work on OSX 10.9.4, using Erlang/OTP 17 [erts-6.1] [source] [64-bit] [smp:8:8] Erlang has compiled and started some projects, and the installation is recent.
I have no idea why do_boot can't start rmbrDb
Note that the other app can't be started as well. It crashes at whichever comes first.
The -s
option to erl
doesn't start the given application, but calls a function. The function name and its arguments can be given as extra arguments, but if you just write -s rmbrDb
, the function name will default to start
and the argument list to the empty list, so erl
will attempt to call rmbrDb:start()
, and that function is not defined (undef
). See the documentation page for erl for more information.
You should look into creating a release for your applications. There are some pointers in this answer.