Mix failing to parse `sext` (Sortable Erlang Term Serialization library)

Hello everybody!

I was trying to use sext library in an Elixir project but Mix can’t build it. After some initial Github browsing I’ve seen that sext uses the dynamic configuration feature of Rebar in a check of the tool’s version.

I’ve opened an issue there but thinking it through, plenty of people are using this library directly in Erlang projects (like Lasp).

Can anyone confirm the issue? I am a total noob in rebar…

OBS: I have rebar and rebar3 installed directly through mix. Tried with Erlang 19.3 and 20. Elixir 1.5.2.

P.S. 2: to reproduce create a dumb project and add {:sext, "~> 1.4"}. Then, mix deps.get and I get a:

Error evaluating Rebar config script ./rebar.config.script:19: evaluation failed with reason error:{badmatch,[{erl_opts,[debug_info]},{profiles,[{docs,[{deps,[{edown,{git,[104,116,116,112,115,58,47,47,103,105,116,104,117,98,46,99,111,109,47,117,119,105,103,101,114,47,101,100,111,119,110,46,103,105,116],{tag,[48,46,56]}}}]},{edoc_opts,[{doclet,edown_doclet},{packages,false},{subpackages,true},{top_level_readme,{[46,47,82,69,65,68,77,69,46,109,100],[104,116,116,112,58,47,47,103,105,116,104,117,98,46,99,111,109,47,117,119,105,103,101,114,47,115,101,120,116]}}]}]}]},{deps,[{edown,[46,42],{git,[103,105,116,58,47,47,103,105,116,104,117,98,46,99,111,109,47,117,119,105,103,101,114,47,101,100,111,119,110,46,103,105,116],[72,69,65,68]}}]},{src_dirs,[[101,120,97,109,112,108,101,115]]},{edoc_opts,[{doclet,edown_doclet},{src_path,[[115,114,99,47],[101,120,97,109,112,108,101,115,47]]},{app_default,[104,116,116,112,58,47,47,119,119,119,46,101,114,108,97,110,103,46,111,114,103,47,100,111,99,47,109,97,110]},{top_level_readme,{[46,47,82,69,65,68,77,69,46,109,100],[104,116,116,112,58,47,47,103,105,116,104,117,98,46,99,111,109,47,117,119,105,103,101,114,47,115,101,120,116]}}]}]} and stacktrace [{erl_eval,expr,3,[]}]
Any dependencies defined in the script won't be available unless you add them to your Mix project
1 Like

Don’t know what is going on. IsRebar3 = erlang:function_exported(rebar3, main, 1) probably fails on your system. which crashes everything.

As an experiment I modified IsRebar3 in deps/sext/rebar.config.script to say IsRebar3 = true and did mix deps.get again and it works but it is not pretty

Update: I’ve seen another rebar.config.script do this:
case erlang:function_exported(rebar3, main, 1) orelse erlang:function_exported('Elixir.Mix.Rebar', rebar_cmd, 1) which sort of indicates to me that sext rebar.config.script might have to be modified to work with mix.

We are discussing ways to have a fake rebar3 module because this kind of checks are too common and checking for Mix is not pretty. I wish rebar3 set an environment variable or something else but I guess this ship has sailed.

Alternatively, you may be able to make it work by setting manager: :rebar in your dependency.

I tried that yesterday, it did not work either.

Error evaluating Rebar config script ./rebar.config.script:19: evaluation failed with reason error:{badmatch,[{erl_opts,[debug_info]},{profiles,[{docs,[{deps,[{edown,{git,[104,116,116,112,115,58,47,47,103,105,116,104,117,98,46,99,111,109,47,117,119,105,103,101,114,47,101,100,111,119,110,46,103,105,116],{tag,[48,46,56]}}}]},{edoc_opts,[{doclet,edown_doclet},{packages,false},{subpackages,true},{top_level_readme,{[46,47,82,69,65,68,77,69,46,109,100],[104,116,116,112,58,47,47,103,105,116,104,117,98,46,99,111,109,47,117,119,105,103,101,114,47,115,101,120,116]}}]}]}]},{deps,[{edown,[46,42],{git,[103,105,116,58,47,47,103,105,116,104,117,98,46,99,111,109,47,117,119,105,103,101,114,47,101,100,111,119,110,46,103,105,116],[72,69,65,68]}}]},{src_dirs,[[101,120,97,109,112,108,101,115]]},{edoc_opts,[{doclet,edown_doclet},{src_path,[[115,114,99,47],[101,120,97,109,112,108,101,115,47]]},{app_default,[104,116,116,112,58,47,47,119,119,119,46,101,114,108,97,110,103,46,111,114,103,47,100,111,99,47,109,97,110]},{top_level_readme,{[46,47,82,69,65,68,77,69,46,109,100],[104,116,116,112,58,47,47,103,105,116,104,117,98,46,99,111,109,47,117,119,105,103,101,114,47,115,101,120,116]}}]}]} and stacktrace [{erl_eval,expr,3,[]}]
Any dependencies defined in the script won't be available unless you add them to your Mix project

Same with :rebar3, and I don’t know if :rebar2 is an option but that one breaks in a new way (no build script found).

After raising the issue in the repo, Ulf Wieger said it was an old issue that he had not commited to the repo by mistake.

Current version 1.4.1 compiles with the following configuration:

      {:sext, "~> 1.4", manager: :rebar},
      {:edown, "~> 0.8"}

Thanks everybody for the help!

2 Likes