Pergunta

I have a weird problem building a release of an erlang application that I'm working on, using rebar. Essentially, it can't seem to locate the erlang thrift client, which is installed on my system. I can verify this by loading the thrift application from the erlang prompt:

$ erl
Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:4:4] [rq:4] [async-threads:0] [kernel-poll:false]

Eshell V5.8.5  (abort with ^G)
1> application:load(thrift).
ok
2> application:loaded_applications().
[{kernel,"ERTS  CXC 138 10","2.14.5"},
 {thrift,"Thrift bindings","0.9.0-dev"},
 {stdlib,"ERTS  CXC 138 10","1.17.5"}]
3> 

However, when I attempt to run 'rebar generate' to build a release of my application, it fails:

$ rebar generate
==> rel (generate)
{"init terminating in do_boot","Release fern uses non existing application thrift"}

Crash dump was written to: erl_crash.dump
init terminating in do_boot (Release fern uses non existing application thrift)

Here is my application file, fern.app.src:

{application, fern, [
  {description, "elided"},
  {vsn, "0.5.0"},
  {modules, [
    fern_app,
    fern_sup,
    accounts_repository,
    fern_http_request,
    fern_system_api,
    metadata_fetcher,
    metadata_process,
    repository,
    repository_server,
    timestamps_repository,
    hbase_thrift,
    hbase_types,
    utils
  ]},
  {registered, [
    fern_sup
  ]},
  {applications, [
    kernel,
    stdlib,
    inets,
    ssl 
  ]},
  {mod, { fern_app, []}},
  {env, []},
  {agner, [
    {requires, ["jiffy", "meck", "mochiweb"]}
  ]}
]}.

...and my reltool.config:

{sys, [
       {lib_dirs, ["../apps", "../deps"]},
       {erts, [{mod_cond, derived}, {app_file, strip}]},
       {app_file, strip},
       {rel, "fern", "1",
        [
         kernel,
         stdlib,
         sasl,
         ssl,
         inets,
         thrift,
         fern
        ]},
       {rel, "start_clean", "",
        [
         kernel,
         stdlib
        ]},
       {boot_rel, "fern"},
       {profile, embedded},
       {incl_cond, exclude},
       {excl_archive_filters, [".*"]}, %% Do not archive built libs
       {excl_sys_filters, ["^bin/.*", "^erts.*/doc", "^erts.*/src",
                           "^erts.*/info", "^erts.*/man",
                           "^erts.*/lib", "^erts.*/include",
                           "^erts.*/bin/(dialyzer|typer)"]},
       {excl_app_filters, ["\.gitignore"]},
       {app, sasl,   [{incl_cond, include}]},
       {app, stdlib, [{incl_cond, include}]},
       {app, kernel, [{incl_cond, include}]},
       {app, inets,  [{incl_cond, include}]},
       {app, crypto, [{incl_cond, include}]},
       {app, public_key, [{incl_cond, include}]},
       {app, ssl,    [{incl_cond, include}]},
       {app, thrift, [{incl_cond, include}]},
       {app, fern, [{incl_cond, include}]}
      ]}.

{target_dir, "fern"}.

{overlay, [
           {mkdir, "log/sasl"},
           {copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
           {copy, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"},
           {copy, "files/fern", "bin/fern"},
           {copy, "files/sys.config", "releases/\{\{rel_vsn\}\}/sys.config"},
           {copy, "files/fern.cmd", "bin/fern.cmd"},
           {copy, "files/start_erl.cmd", "bin/start_erl.cmd"},
           {copy, "files/vm.args", "releases/\{\{rel_vsn\}\}/vm.args"}
          ]}.

I should note that if I remove thrift from the applications list in both, the release generates, but doesn't include the thrift libraries, and therefore fails at runtime. Would anyone be able to offer me any guidance about what I'm doing wrong here?

Many thanks,

Tim

Foi útil?

Solução

For the sake of anyone else who comes across this - I eventually worked out the problem. For some reason, rebar renames the 'thrift' application to 'thrift-0.9.0-dev' inside the release. Changing all instances of the atom 'thrift' in the above configuration to 'thrift-0.9.0-dev' (note this is an atom, not a string - use single quotes) will sort it out.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top