Error when compiling hackney dependency

Today is my first day trying out an elixir project. I installed elixir and erlang using the latest in Fedora.
I’m getting a compile error when trying to install a mix package (instream) that has a hackney dependency:

$ mix phx.server  
===> Compiling hackney
===> Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace or consult rebar3.crashdump
===> When submitting a bug report, please include the output of `rebar3 report "your command"`
** (Mix) Could not compile dependency :hackney, "/home/rando/.mix/rebar3 bare compile --paths "/home/rando/Code/textus/sawmill/_build/dev/lib/*/ebin"" command failed. You can recompile this dependency with "mix deps.compile hackney", update it with "mix deps.update hackney" or clean it with "mix deps.clean hackney"

When trying to compile as it suggests using DEBUG=1:

$ DEBUG=1 mix deps.compile hackney
===> Expanded command sequence to be run: []
===> Expanded command sequence to be run: [{default,app_discovery},
                                           {bare,compile}]
===> Compiling hackney
===> run_hooks("/home/rando/Code/textus/sawmill/deps/hackney", pre_hooks, compile) -> no hooks defined

===> run_hooks("/home/rando/Code/textus/sawmill/deps/hackney", pre_hooks, erlc_compile) -> no hooks defined

===> erlopts [debug_info,debug_info,{d,namespaced_types}]
===> files to compile ["/home/rando/Code/textus/sawmill/deps/hackney/src/hackney_response.erl",
                       "/home/rando/Code/textus/sawmill/deps/hackney/src/hackney_manager.erl",
                       "/home/rando/Code/textus/sawmill/deps/hackney/src/hackney_local_tcp.erl",
                       "/home/rando/Code/textus/sawmill/deps/hackney/src/hackney_socks5.erl",
                       "/home/rando/Code/textus/sawmill/deps/hackney/src/hackney_ssl.erl",
                       "/home/rando/Code/textus/sawmill/deps/hackney/src/hackney_date.erl",
                       "/home/rando/Code/textus/sawmill/deps/hackney/src/hackney_url.erl",
                       "/home/rando/Code/textus/sawmill/deps/hackney/src/hackney_tcp.erl",
                       "/home/rando/Code/textus/sawmill/deps/hackney/src/hackney_headers_new.erl",
                       "/home/rando/Code/textus/sawmill/deps/hackney/src/hackney.erl",
                       "/home/rando/Code/textus/sawmill/deps/hackney/src/hackney_connect.erl",
                       "/home/rando/Code/textus/sawmill/deps/hackney/src/hackney_sup.erl",
                       "/home/rando/Code/textus/sawmill/deps/hackney/src/hackney_pool.erl",
                       "/home/rando/Code/textus/sawmill/deps/hackney/src/hackney_bstr.erl",
                       "/home/rando/Code/textus/sawmill/deps/hackney/src/hackney_stream.erl",
                       "/home/rando/Code/textus/sawmill/deps/hackney/src/hackney_http_connect.erl",
                       "/home/rando/Code/textus/sawmill/deps/hackney/src/hackney_http.erl",
                       "/home/rando/Code/textus/sawmill/deps/hackney/src/hackney_multipart.erl",
                       "/home/rando/Code/textus/sawmill/deps/hackney/src/hackney_pool_handler.erl",
                       "/home/rando/Code/textus/sawmill/deps/hackney/src/hackney_util.erl",
                       "/home/rando/Code/textus/sawmill/deps/hackney/src/hackney_headers.erl",
                       "/home/rando/Code/textus/sawmill/deps/hackney/src/hackney_request.erl",
                       "/home/rando/Code/textus/sawmill/deps/hackney/src/hackney_cookie.erl",
                       "/home/rando/Code/textus/sawmill/deps/hackney/src/hackney_trace.erl",
                       "/home/rando/Code/textus/sawmill/deps/hackney/src/hackney_app.erl"]
===> Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace or consult rebar3.crashdump
===> Uncaught error: badarg
===> Stack trace to the error location:
[{re,run,[{error,bad_name},"^.*-(?<VER>[^/-]*)$",[{capture,[1],list}]],[]},
 {rebar_hooks,re_version,1,
              [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_hooks.erl"},
               {line,146}]},
 {rebar_hooks,create_env,2,
              [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_hooks.erl"},
               {line,134}]},
 {rebar_hooks,run_hooks,5,
              [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_hooks.erl"},
               {line,97}]},
 {rebar_hooks,run_all_hooks,6,
              [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_hooks.erl"},
               {line,17}]},
 {rebar_prv_compile,compile,3,
                    [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_prv_compile.erl"},
                     {line,123}]},
 {rebar_prv_bare_compile,do,1,
                         [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_prv_bare_compile.erl"},
                          {line,47}]},
 {rebar_core,do,2,
             [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_core.erl"},
              {line,153}]}]
===> When submitting a bug report, please include the output of `rebar3 report "your command"`
** (Mix) Could not compile dependency :hackney, "/home/rando/.mix/rebar3 bare compile --paths "/home/rando/Code/textus/sawmill/_build/dev/lib/*/ebin"" command failed. You can recompile this dependency with "mix deps.compile hackney", update it with "mix deps.update hackney" or clean it with "mix deps.clean hackney"

Even trying to compile it manually results in the same error:

$ cd deps/hackney; DEBUG=1 ~/.mix/rebar3 compile
...
===>      Compiled hackney_app.erl
===> Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace or consult rebar3.crashdump
===> Uncaught error: badarg
===> Stack trace to the error location:
[{re,run,[{error,bad_name},"^.*-(?<VER>[^/-]*)$",[{capture,[1],list}]],[]},
 {rebar_hooks,re_version,1,
              [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_hooks.erl"},
               {line,146}]},

I also grabbed the latest hackeny from github, same error.

$ ~/.mix/rebar3 --version
rebar 3.3.6 on Erlang/OTP 19 Erts 8.3.5.1

It looks like the latest rebar3 on their github releases page is 3.4.3, is that something I need to update? I seems like I have the latest that mix will give me:

$ mix local.rebar 
/home/rando/.mix/rebar already exists, overwrite? [Yn] 
* creating /home/rando/.mix/rebar
/home/rando/.mix/rebar3 already exists, overwrite? [Yn] 
* creating /home/rando/.mix/rebar3

What is this "/home/tristan/Devel/rebar3/..." stuff I’m seeing in the paths? That’s not my user; is that some artifact from whomever compiled rebar3 that mix is using? Is it related to my issue?

Just a quick update, I manually installed the latest version of rebar3, and cloned the hackney project from git, I get the same error:

$ ~/.mix/rebar3 --version
rebar 3.4.3 on Erlang/OTP 19 Erts 8.3.5.1
                                                                                                                                
$ ~/.mix/rebar3 compile  
===> Verifying dependencies...
===> Compiling hackney
===> Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace or consult rebar3.crashdump
===> When submitting a bug report, please include the output of `rebar3 report "your command"`
                                                                                                                                

$ cat rebar3.crashdump 
Error: badarg
[{re,run,
     [{error,bad_name},"^.*-(?<VER>[^/-]*)$",[{capture,[1],list},unicode]],
     [{file,"re.erl"},{line,689}]},
 {rebar_hooks,re_version,1,
              [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_hooks.erl"},
               {line,146}]},
 {rebar_hooks,create_env,2,
              [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_hooks.erl"},
               {line,134}]},
 {rebar_hooks,run_hooks,5,
              [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_hooks.erl"},
               {line,97}]},
 {rebar_hooks,run_all_hooks,6,
              [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_hooks.erl"},
               {line,17}]},
 {rebar_prv_compile,compile,3,
                    [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_prv_compile.erl"},
                     {line,123}]},
 {rebar_prv_compile,'-build_apps/3-lc$^0/1-0-',3,
                    [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_prv_compile.erl"},
                     {line,81}]},
 {rebar_prv_compile,do,1,
                    [{file,"/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_prv_compile.erl"},
                     {line,54}]}]

What if you use OTP 20? 19 is old now and 20 had some regex changes that I’m wonder if this is hitting (without really looking in to it).

Well, appearently just installing erlang on Fedora isn’t enough. I installed erlang-rebar, and it installed a couple dozen other erlang-* packages, and now hackney compiles as expected, even using the mix-provided rebar.

The error messages could be better, I still have no idea what package was actually needed to install. It must have been one of these:

 erlang-common_test                       x86_64          19.3.6.1-1.fc25                                updates          1.1 M
 erlang-debugger                          x86_64          19.3.6.1-1.fc25                                updates          408 k
 erlang-dialyzer                          x86_64          19.3.6.1-1.fc25                                updates          662 k
 erlang-diameter                          x86_64          19.3.6.1-1.fc25                                updates          721 k
 erlang-edoc                              x86_64          19.3.6.1-1.fc25                                updates          328 k
 erlang-eflame                            x86_64          0-0.2.gita085181.fc25                          fedora            48 k
 erlang-erl_interface                     x86_64          19.3.6.1-1.fc25                                updates          194 k
 erlang-erlydtl                           x86_64          0.11.1-1.fc25                                  fedora           380 k
 erlang-et                                x86_64          19.3.6.1-1.fc25                                updates          173 k
 erlang-eunit                             x86_64          19.3.6.1-1.fc25                                updates          161 k
 erlang-getopt                            x86_64          0.8.2-4.fc25                                   fedora            41 k
 erlang-gettext                           x86_64          2.1.0-0.12.20140318gitcb4654d.fc25             fedora           128 k
 erlang-lfe                               x86_64          1.2.1-1.fc25                                   updates          547 k
 erlang-mustache                          x86_64          0.1.1-4.fc25                                   fedora            26 k
 erlang-neotoma                           x86_64          1.7.4-1.fc25                                   updates           49 k
 erlang-observer                          x86_64          19.3.6.1-1.fc25                                updates          829 k
 erlang-protobuffs                        x86_64          0.9.0-1.fc25                                   updates          115 k
 erlang-rebar                             x86_64          2.6.4-2.fc25                                   fedora           362 k
 erlang-reltool                           x86_64          19.3.6.1-1.fc25                                updates          359 k
 erlang-rpm-macros                        noarch          0.2.7-1.fc25                                   updates           17 k
 erlang-sasl                              x86_64          19.3.6.1-1.fc25                                updates          296 k
 erlang-snmp                              x86_64          19.3.6.1-1.fc25                                updates          1.6 M
 erlang-ssh                               x86_64          19.3.6.1-1.fc25                                updates          503 k
 erlang-wx                                x86_64          19.3.6.1-1.fc25                                updates          3.1 M
 erlang-xmerl                             x86_64          19.3.6.1-1.fc25                                updates          1.0 M
2 Likes

Yeah a lot of repo’s break erlang up into parts for irritating reasons, usually good to make sure you have it all installed. ^.^