meddle0x53 / echo

OTP example with LFE : Echo
1 stars 0 forks source link

`mix lfe.setup` fails. #1

Open simonelnahas opened 4 months ago

simonelnahas commented 4 months ago

It seems mix_lfe doesn't work with the latest version of either Elixir or LFE. I have installed the

> elixir --version
Erlang/OTP 26 [erts-14.2.5] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit] [dtrace]

> mix archive.install ./mix_lfe_new-0.2.0.ez
warning: use Mix.Config is deprecated. Use the Config module instead
  config/config.exs:3

Found existing entry: /Users/simonelnahas/.mix/archives/mix_lfe_new-0.2.0
Are you sure you want to replace it with "./mix_lfe_new-0.2.0.ez"? [Yn] y
* creating /Users/simonelnahas/.mix/archives/mix_lfe_new-0.2.0

> mix lfe.setup
warning: use Mix.Config is deprecated. Use the Config module instead
  config/config.exs:3

warning: use Mix.Config is deprecated. Use the Config module instead
  config/config.exs:3

Resolving Hex dependencies...
Resolution completed in 0.01s
Unchanged:
  erlang_color 1.0.0
  lfe 1.2.0
  ltest 0.10.0-rc6
  lutil 0.10.0-rc6
  mix_lfe 0.2.0-rc3
All dependencies are up to date
warning: use Mix.Config is deprecated. Use the Config module instead
  config/config.exs:3

* creating /Users/simonelnahas/.mix/elixir/1-15/rebar3
===> Verifying dependencies...
===> Analyzing applications...
===> Compiling lfe
2024-05-15 13:06:19.007591 crash_report        
    initial_call: {supervisor_bridge,user_sup,['Argument__1']}
    pid: <0.64.0>
    registered_name: []
    error_info: {error,undef,[{user,start,[],[]},{lfe_init,start,0,[{file,"/Users/simonelnahas/Documents/Developer/echo/deps/lfe/src/lfe_init.erl"},{line,43}]},{user_sup,start_user,3,[{file,"user_sup.erl"},{line,102}]},{user_sup,init,1,[{file,"user_sup.erl"},{line,51}]},{supervisor_bridge,init,1,[{file,"supervisor_bridge.erl"},{line,87}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,980}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,935}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,241}]}]}
    ancestors: [kernel_sup,<0.47.0>]
    message_queue_len: 0
    messages: []
    links: [<0.49.0>]
    dictionary: []
    trap_exit: true
    status: running
    heap_size: 987
    stack_size: 28
    reductions: 357
=SUPERVISOR REPORT==== 15-May-2024::13:06:19.007618 ===
    supervisor: {local,kernel_sup}
    errorContext: start_error
    reason: {undef,
                [{user,start,[],[]},
                 {lfe_init,start,0,
                     [{file,
                          "/Users/simonelnahas/Documents/Developer/echo/deps/lfe/src/lfe_init.erl"},
                      {line,43}]},
                 {user_sup,start_user,3,[{file,"user_sup.erl"},{line,102}]},
                 {user_sup,init,1,[{file,"user_sup.erl"},{line,51}]},
                 {supervisor_bridge,init,1,
                     [{file,"supervisor_bridge.erl"},{line,87}]},
                 {gen_server,init_it,2,[{file,"gen_server.erl"},{line,980}]},
                 {gen_server,init_it,6,[{file,"gen_server.erl"},{line,935}]},
                 {proc_lib,init_p_do_apply,3,
                     [{file,"proc_lib.erl"},{line,241}]}]}
    offender: [{pid,undefined},
               {id,user},
               {mfargs,{user_sup,start,[]}},
               {restart_type,temporary},
               {significant,false},
               {shutdown,2000},
               {child_type,supervisor}]

2024-05-15 13:06:19.008243 crash_report        
    initial_call: {application_master,init,['Argument__1','Argument__2','Argument__3','Argument__4']}
    pid: <0.46.0>
    registered_name: []
    error_info: {exit,{{shutdown,{failed_to_start_child,user,{undef,[{user,start,[],[]},{lfe_init,start,0,[{file,"/Users/simonelnahas/Documents/Developer/echo/deps/lfe/src/lfe_init.erl"},{line,43}]},{user_sup,start_user,3,[{file,"user_sup.erl"},{line,102}]},{user_sup,init,1,[{file,"user_sup.erl"},{line,51}]},{supervisor_bridge,init,1,[{file,"supervisor_bridge.erl"},{line,87}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,980}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,935}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,241}]}]}}},{kernel,start,[normal,[]]}},[{application_master,init,4,[{file,"application_master.erl"},{line,142}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,241}]}]}
    ancestors: [<0.45.0>]
    message_queue_len: 1
    messages: [{'EXIT',<0.47.0>,normal}]
    links: [<0.45.0>,<0.44.0>]
    dictionary: []
    trap_exit: true
    status: running
    heap_size: 1598
    stack_size: 28
    reductions: 213
2024-05-15 13:06:19.008203 Error in process ~p with exit value:~n~p~n
        <0.65.0>
        {badarg,[{erlang,send,[code_server,{code_call,<0.65.0>,{load_module,#Ref<0.2217597043.2115895305.214783>,logger_formatter,"/opt/homebrew/Cellar/erlang/26.2.5/lib/erlang/lib/kernel-9.2.4/ebin/logger_formatter.beam",false,#Ref<0.2217597043.2115764233.214782>}}],[{error_info,#{module=>erl_erts_errors}}]},{code_server,call,1,[{file,"code_server.erl"},{line,150}]},{error_handler,undefined_function,3,[{file,"error_handler.erl"},{line,40}]},{logger_simple_h,'-do_log/2-fun-0-',1,[{file,"logger_simple_h.erl"},{line,154}]}]}
2024-05-15 13:06:19.008305 std_info            
    application: kernel
    exited: {{shutdown,{failed_to_start_child,user,{undef,[{user,start,[],[]},{lfe_init,start,0,[{file,"/Users/simonelnahas/Documents/Developer/echo/deps/lfe/src/lfe_init.erl"},{line,43}]},{user_sup,start_user,3,[{file,"user_sup.erl"},{line,102}]},{user_sup,init,1,[{file,"user_sup.erl"},{line,51}]},{supervisor_bridge,init,1,[{file,"supervisor_bridge.erl"},{line,87}]},{gen_server,init_it,2,[{file,"gen_server.erl"},{line,980}]},{gen_server,init_it,6,[{file,"gen_server.erl"},{line,935}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,241}]}]}}},{kernel,start,[normal,[]]}}
    type: permanent
Kernel pid terminated (application_controller) ("{application_start_failure,kernel,{{shutdown,{failed_to_start_child,user,{undef,[{user,start,[],[]},{lfe_init,start,0,[{file,\"/Users/simonelnahas/Documents/Developer/echo/deps/lfe/src/lfe_init.erl\"},{line,43}]},{user_sup,start_user,3,[{file,\"user_sup.erl\"},{line,102}]},{user_sup,init,1,[{file,\"user_sup.erl\"},{line,51}]},{supervisor_bridge,init,1,[{file,\"supervisor_bridge.erl\"},{line,87}]},{gen_server,init_it,2,[{file,\"gen_server.erl\"},{line,980}]},{gen_server,init_it,6,[{file,\"gen_server.erl\"},{line,935}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,241}]}]}}},{kernel,start,[normal,[]]}}}")

Crash dump is being written to: erl_crash.dump...done
===> Hook for app_compile failed!
simonelnahas commented 4 months ago

LFE is installed and works with rebar

> rebar3 lfe repl
===> Verifying dependencies...
Erlang/OTP 26 [erts-14.2.5] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit] [dtrace]

   ..-~.~_~---..
  (      \\     )    |   A Lisp-2+ on the Erlang VM
  |`-.._/_\\_.-':    |   Type (help) for usage info.
  |         g |_ \   |
  |        n    | |  |   Docs: http://docs.lfe.io/
  |       a    / /   |   Source: http://github.com/lfe/lfe
   \     l    |_/    |
    \   r     /      |   LFE v2.1.2 (abort with ^C; enter JCL with ^G)
     `-E___.-'

lfe> 
simonelnahas commented 4 months ago

I believe I have isolated the error to be in LFE: https://github.com/lfe/lfe/issues/489

meddle0x53 commented 2 months ago

Hmm yeah, I also tried to upgrade it (haven't used that tool for years) and it seems I can not even depend on lfe in mix right now... Saw your issue in their repo, no answer, tried some things myself but to be honest it is related to how mix uses rebar to compile erlang deps. Basically as part of the LFE dep compilation it does this:

DIAGNOSTIC=1 /Users/meddle/.asdf/installs/elixir/1.16.2-otp-26/.mix/elixir/1-16/rebar3 bare compile --paths /Users/meddle/development/lfe/echo/mix_lfe/_build/dev/lib/lfe/ebin/
===> Expanded command sequence to be run: []
===> Running provider: do
===> Expanded command sequence to be run: [app_discovery,{bare,compile}]
===> Running provider: app_discovery
===> Uncaught error in rebar_core. Run with DIAGNOSTIC=1 to see stacktrace or consult rebar3.crashdump
===> Uncaught error: {badmatch,{error,enoent}}
===> Stack trace to the error location:
[{ec_file,real_dir_path,1,
          [{file,"/rebar3/vendor/erlware_commons/src/ec_file.erl"},
           {line,220}]},
 {rebar_app_discover,'-define_root_app/2-fun-0-',2,
                     [{file,"/rebar3/apps/rebar/src/rebar_app_discover.erl"},
                      {line,82}]},
 {ec_lists,find,2,
           [{file,"/rebar3/vendor/erlware_commons/src/ec_lists.erl"},
            {line,45}]},
 {rebar_app_discover,define_root_app,2,
                     [{file,"/rebar3/apps/rebar/src/rebar_app_discover.erl"},
                      {line,81}]},
 {rebar_app_discover,do,2,
                     [{file,"/rebar3/apps/rebar/src/rebar_app_discover.erl"},
                      {line,35}]},
 {rebar_prv_app_discovery,do,1,
                          [{file,"/rebar3/apps/rebar/src/rebar_prv_app_discovery.erl"},
                           {line,38}]},
 {rebar_core,do,2,[{file,"/rebar3/apps/rebar/src/rebar_core.erl"},{line,155}]},
 {rebar_prv_do,do_task,5,
               [{file,"/rebar3/apps/rebar/src/rebar_prv_do.erl"},{line,87}]}]
===> When submitting a bug report, please include the output of `rebar3 report "your command"`

And this is the error, which I spent some time debugging, but am not sure if I can understand even...