Hello, I am creating a project where I mix Erlang and Elixir applications.
I can do this when running Erlang by executing erl manually from my bash shell and adding the path to the elixir installation using the Erlangs code module, like this:
$> erl
Erlang/OTP 24 [erts-12.0] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit]
Eshell V12.0 (abort with ^G)
1> application:start(compiler).
ok
2> code:add_path("/usr/local/lib/elixir/lib/elixir/ebin").
true
3> application:start(elixir).
ok
However, when I do the exact same inside a release that I built with rebar3, it seems like the VM can not execute any code, even if it finds the elixir.app file.
$>bin/ao_devserver console
Erlang/OTP 24 [erts-12.0] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:30] [jit]
Eshell V12.0 (abort with ^G)
(ao_devserver@pop-os)1> application:start(compiler).
{error,{already_started,compiler}}
(ao_devserver@pop-os)2> code:add_path("/usr/local/lib/elixir/lib/elixir/ebin").
true
(ao_devserver@pop-os)3> application:start(elixir).
=CRASH REPORT==== 24-Apr-2022::06:19:38.775000 ===
crasher:
initial call: application_master:init/4
pid: <0.998.0>
registered_name: []
exception exit: {bad_return,
{{elixir,start,[normal,[]]},
{'EXIT',
{undef,
[{elixir,start,[normal,[]],[]},
{application_master,start_it_old,4,
[{file,"application_master.erl"},
{line,293}]}]}}}}
in function application_master:init/4 (application_master.erl, line 142)
ancestors: [<0.997.0>]
message_queue_len: 1
messages: [{'EXIT',<0.999.0>,normal}]
links: [<0.997.0>,<0.791.0>]
dictionary: []
trap_exit: true
status: running
heap_size: 987
stack_size: 29
reductions: 156
neighbours:
=INFO REPORT==== 24-Apr-2022::06:19:38.776020 ===
application: elixir
exited: {bad_return,
{{elixir,start,[normal,[]]},
{'EXIT',
{undef,
[{elixir,start,[normal,[]],[]},
{application_master,start_it_old,4,
[{file,"application_master.erl"},
{line,293}]}]}}}}
type: temporary
{error,
{bad_return,
{{elixir,start,[normal,[]]},
{'EXIT',
{undef,
[{elixir,start,[normal,[]],[]},
{application_master,start_it_old,4,
[{file,"application_master.erl"},{line,293}]}]}}}}}
I spent two evenings trying to figure this out, reading on stack-overflow, these forums etc but could not find anyone with same problem as me, maybe I am doing it wrong?