2016-11-25 52 views
0

我有简单的功能:Rebar3不“包括”我的非应用程序的DEP

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

正如你可以看到它依赖于库瞬间。所以我加了它在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) 
+0

你是否先运行'rebar3 upgrade'。如果我是正确的,它会在deps目录中安装所有必要的依赖关系。 – Pascal

+0

当然...我也清理了一切。编辑:我只是做rebar3升级,没有任何改变。 – Haito

+0

@Pascal另外值得注意的是,牛仔作品和jiffy不 – Haito

回答

3

瞬间需要一个端口编译器插件,是不是钢筋的一部分。你可以在你的rebar.config中配置它如下:

{plugins, [ 
    { pc, {git, "[email protected]:blt/port_compiler.git", {branch, "master"}}} 
]}. 
{overrides, 
[{override, jiffy, [ 
    {plugins, [pc]}, 
    {artifacts, ["priv/jiffy.so"]}, 
    {provider_hooks, [ 
     {post, 
      [ 
      {compile, {pc, compile}}, 
      {clean, {pc, clean}} 
      ] 
      }] 
     } 
    ]} 
]}. 
+0

这是答案的一部分..我需要将它添加到应用程序。我认为应用程序列表是为了开始......而且似乎没有。但是,当我添加你的部件并将jiffy添加到应用程序列表中后,它似乎可以工作或者至少不会崩溃 – Haito

+0

我相信你需要将jiffy添加到应用程序中,因为nif需要初始化。无论应用程序是否包含在您的发行版/环境中的所有应用程序中,无论它们是否需要启动 – ArgumentError

+0

在我添加该插件之前崩溃了。我不知道有这种需要。 – Haito

相关问题