2

我在使用 rebar 构建我正在开发的 erlang 应用程序版本时遇到了一个奇怪的问题。本质上,它似乎无法找到安装在我的系统上的 erlang thrift 客户端。我可以通过从 erlang 提示符加载节俭应用程序来验证这一点:

$ 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> 

但是,当我尝试运行“rebar generate”来构建我的应用程序的版本时,它失败了:

$ 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)

这是我的应用程序文件 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"]}
  ]}
]}.

...和我的 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"}
          ]}.

我应该注意,如果我从两者的应用程序列表中删除 thrift,则该版本会生成,但不包含 thrift 库,因此在运行时会失败。任何人都可以就我在这里做错的事情向我提供任何指导吗?

非常感谢,

蒂姆

4

1 回答 1

4

为了其他遇到这个问题的人 - 我最终解决了这个问题。出于某种原因,rebar 在发行版中将“thrift”应用程序重命名为“thrift-0.9.0-dev”。将上述配置中原子“thrift”的所有实例更改为“thrift-0.9.0-dev”(注意这是原子,而不是字符串 - 使用单引号)将对其进行排序。

于 2012-02-24T16:24:30.090 回答