Haito
Haito

Reputation: 2069

Rebar3 not "including" my non-application deps

I have simple function:

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

As you can see it depends on library jiffy. So I added it in 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}]
}.

But when i run rebar3 run and program get's do that point i get error that that function is undefined.

Edit: I run rebar3 tree to check if dep is recognized and here is result:

└─ 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)

Upvotes: 0

Views: 834

Answers (1)

ArgumentError
ArgumentError

Reputation: 366

jiffy needs a port compiler plugin that is not part of rebar. you can configure it in your rebar.config as follows:

{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}}
             ]
          }]
      }
  ]}
]}.

Upvotes: 3

Related Questions