barrel-db / rebar3_elixir_compile

Elixir rebar3 compiler plugin
Other
90 stars 29 forks source link

Working with elixir dependencies for an escript #21

Open PragTob opened 7 years ago

PragTob commented 7 years ago

:wave:

Me again. So, say - is there a way to make this work with an escript/rebar3 escriptize (Dislaimer: I might also be using escript wrong).

I used rebar3 to create an escript project: https://github.com/PragTob/benchee_erlang_try

Now generating the script failed:

tobi@speedy ~/github/benchee_erlang $ ./_build/default/bin/benchee_erlang 
escript: exception error: undefined function 'Elixir.Benchee':run/1
  in function  benchee_erlang:main/1 (/home/tobi/github/benchee_erlang/_build/default/lib/benchee_erlang/src/benchee_erlang.erl, line 16)
  in call from escript:run/2 (escript.erl, line 757)
  in call from escript:start/1 (escript.erl, line 277)
  in call from init:start_em/1 
  in call from init:do_boot/3 

Of course, though! Haven't added benchee to the applications. But when I add benchee to the applications this happens:

tobi@speedy ~/github/benchee_erlang $ DEBUG=1 rebar3 escriptize
# lots of stuff that I'll spare you...

===> Building escript...
===> Creating escript file /home/tobi/github/benchee_erlang/_build/default/bin/benchee_erlang
===> processing <<"benchee_erlang">>
===> new deps of <<"benchee_erlang">> found to be [<<"benchee">>]
===> processing <<"benchee">>
===> new deps of <<"benchee">> found to be [<<"elixir">>,<<"logger">>,
                                                   <<"deep_merge">>]
===> processing <<"elixir">>
===> Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace or consult rebar3.crashdump
===> Uncaught error: {badmatch,error}
===> Stack trace to the error location:
[{rebar_prv_escriptize,find_deps_of_deps,3,
                       [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_prv_escriptize.erl"},
                        {line,246}]},
 {rebar_prv_escriptize,find_deps,2,
                       [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_prv_escriptize.erl"},
                        {line,240}]},
 {rebar_prv_escriptize,escriptize,2,
                       [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_prv_escriptize.erl"},
                        {line,104}]},
 {rebar_prv_escriptize,do,1,
                       [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_prv_escriptize.erl"},
                        {line,80}]},
 {rebar_core,do,2,
             [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_core.erl"},
              {line,153}]},
 {rebar3,main,1,
         [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar3.erl"},
          {line,66}]},
 {escript,run,2,[{file,"escript.erl"},{line,757}]},
 {escript,start,1,[{file,"escript.erl"},{line,277}]}]

Seems it doesn't like the transitive elixir dependency there?

Thanks a lot!