I wish to use an erlang client library to communicate with an mqtt broker for one of my projects. So I've started an application using rebar3's built-in templates and added emqttc as a dependency. Since erlang/otp 21 does not have support for gen_logger(emqttc depends on gen_logger) and the tuple_calls
compiler options do not suffice, I had to downgrade to erlang@20 according to this post.
Now the issue with downgrading erlang is that, none of rebar3's commands(clean/compile/shell/report etc) work as expected and my previous projects built with rebar3 do not compile, I get to see this error message:
=ERROR REPORT==== 21-Aug-2018::12:54:29 === Loading of /usr/local/bin/rebar3/rebar/ebin/rebar3.beam failed: badfile escript: exception error: undefined function rebar3:main/1 in function escript:run/2 (escript.erl, line 759) in call from escript:start/1 (escript.erl, line 277) in call from init:start_em/1 in call from init:do_boot/3
=ERROR REPORT==== 21-Aug-2018::12:54:29 === beam/beam_load.c(1863): Error loading module rebar3: This BEAM file was compiled for a later version of the run-time system than 20. To fix this, please recompile this module with an 20 compiler. (Use of opcode 160; this emulator supports only up to 159.)
I've uninstalled and reinstalled rebar3, looked up on the web for this but nothing's clear and specific to rebar. Any help on this would be appreciated.