0

我有简单的功能:

do_stuff(_Whatever) ->
  jiffy:decode(<<"{\"foo\": \"bar\"}">>).

如您所见,它取决于库 jiffy。所以我将它添加到rebar.config

{deps, [
  {cowboy, {git, "https://github.com/ninenines/cowboy", {tag, "2.0.0-pre.1"}}},
  {jiffy, {git, "https://github.com/davisp/jiffy", {tag, "0.14.8"}}}
]}.
{relx, [{release, { myapp, "0.1.0" },
     [vizcerl,
      sasl
      ]},

    %{sys_config, "./config/sys.config"},
    %{vm_args, "./config/vm.args"},

    {dev_mode, true},
    {include_erts, false},

    {extended_start_script, true}]
}.

但是,当我运行rebar3 run程序并执行该操作时,我会收到该函数未定义的错误。

编辑:我跑来rebar3 tree检查 dep 是否被识别,结果如下:

└─ myapp─0.1.0 (project app)
   ├─ cowboy─2.0.0-pre.1 (git repo)
   │  ├─ cowlib─1.0.0 (git repo)
   │  └─ ranch─1.0.0 (git repo)
   └─ jiffy─0.14.8 (git repo)
4

1 回答 1

3

jiffy 需要一个不属于 rebar 的端口编译器插件。你可以在你的 rebar.config 中配置它,如下所示:

{plugins, [
    { pc, {git, "git@github.com:blt/port_compiler.git", {branch, "master"}}}
]}.
{overrides,
 [{override, jiffy, [
     {plugins, [pc]},
     {artifacts, ["priv/jiffy.so"]},
     {provider_hooks, [
         {post,
             [
             {compile, {pc, compile}},
             {clean, {pc, clean}}
             ]
          }]
      }
  ]}
]}.
于 2016-11-25T19:04:13.027 回答