2016-11-25 54 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

相關問題