Cannot start sample erlang release generated with rebar

前端 未结 4 1570
忘了有多久
忘了有多久 2021-01-31 06:36

I\'m a beginner with rebar and erlang generally. I was trying to create an erlang release with rebar according to this tutorial: http://www.metabrew.com/article/erlang-rebar-tut

4条回答
  •  你的背包
    2021-01-31 07:14

    First of all, you can try to see what fails during the booting of the VM by adding the arguments init_debug to the VM:

    $ erl -init_debug
    {progress,preloaded}
    {progress,kernel_load_completed}
    {progress,modules_loaded}
    {start,heart}
    {start,error_logger}
    {start,application_controller}
    {progress,init_kernel_started}
    ...
    {progress,applications_loaded}
    {apply,{application,start_boot,[kernel,permanent]}}
    {apply,{application,start_boot,[stdlib,permanent]}}
    {apply,{c,erlangrc,[]}}
    {progress,started}
    Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:4:4] [rq:4] [async-threads:0] [hipe] [kernel-poll:false]
    
    Eshell V5.8.4  (abort with ^G)
    1>
    

    Using this, you'll be able to see with more details the kind of interactions going on. It might be that libraries are being loaded in the wrong order, you don't support native, etc.


    Second issue, the rel file containing too many applications. This is likely due to the fact that Rebar uses Reltool ot generate releases, and that different applications can be loaded depending on how granular the control is whne generating releases (see incl_cond material in the docs). There are a few examples for this in the Release is The Word chapter of Learn You Some Erlang:

    {sys, [
     {lib_dirs, ["/home/ferd/code/learn-you-some-erlang/release/"]},
     {erts, [{mod_cond, derived}, % derived makes it pick less stuff
             {app_file, strip}]},
     {rel, "erlcount", "1.0.0", [kernel, stdlib, ppool, erlcount]},
     {boot_rel, "erlcount"},
     {relocatable, true},
     {profile, embedded}, % reduces the files included from each app
     {app_file, strip}, % reduces the size of app files if possible
     {incl_cond, exclude}, % by default, don't include apps. 'derived' is another option
     {app, stdlib, [{mod_cond, derived}, {incl_cond, include}]}, % include at the app
     {app, kernel, [{incl_cond, include}]},                      % level overrides the
     {app, ppool, [{vsn, "1.0.0"}, {incl_cond, include}]},       % exclude put earlier
     {app, erlcount, [{vsn, "1.0.0"}, {incl_cond, include}]}
    ]}.
    

    And this should generate smaller releases.

提交回复
热议问题