How do I recompile rebar3 with an Erlang/OTP 25 compiler? Running Elixir 1.13.4
Asked Answered
P

4

6

I´m following the free screencast / tutorial in Phoenix LiveView Starter But I´m not even able to start, as mix setup fails with:

=ERROR REPORT==== 6-Jul-2022::12:47:58.702361 ===
beam/beam_load.c(551): Error loading function rebar3:parse_args/1: op put_tuple u x:
  please re-compile this module with an Erlang/OTP 25 compiler


escript: exception error: undefined function rebar3:main/1
  in function  escript:run/2 (escript.erl, line 750)
  in call from escript:start/1 (escript.erl, line 277)
  in call from init:start_em/1
  in call from init:do_boot/3
** (Mix) Could not compile dependency :telemetry, "/Users/martinstabenfeldt/.mix/rebar3 bare compile --paths /Users/martinstabenfeldt/Work/pragmaticstudio.com-liveview-starter/code-bundle/live_view_studio/_build/dev/lib/*/ebin" command failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile telemetry", update it with "mix deps.update telemetry" or clean it with "mix deps.clean telemetry"
$ elixir --version
Erlang/OTP 25 [erts-13.0.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit:ns] [dtrace]

Elixir 1.13.4 (compiled with Erlang/OTP 24)

My mix.exs deps looks like this:

  defp deps do
    [
      {:phoenix, "~> 1.5.13"},
      {:phoenix_ecto, "~> 4.4"},
      {:ecto_sql, "~> 3.4"},
      {:postgrex, ">= 0.0.0"},
      {:phoenix_live_view, "~> 0.16.4"},
      {:floki, ">= 0.30.0", only: :test},
      {:phoenix_html, "~> 3.0.4"},
      {:phoenix_live_reload, "~> 1.2", only: :dev},
      {:phoenix_live_dashboard, "~> 0.4"},
      {:telemetry_metrics, "~> 0.6"},
      {:telemetry_poller, "~> 1.0"},
      {:gettext, "~> 0.11"},
      {:jason, "~> 1.0"},
      {:plug_cowboy, "~> 2.0"},
      {:faker, "~> 0.17.0"},
      {:number, "~> 1.0"}
    ]
  end

I´m not sure how I can recompile with an OTP 25 compiler. I´m running Elixir 1.13.4. It´s compiled with OTP 24. Not sure if that has anything to do with it? I´ve also tried mix local-rebar --force and mix deps.update telemetry without any luck.

Passing answered 6/7, 2022 at 10:59 Comment(0)
M
7

If you’d examine the elixir --version prompt carefully, you’ll spot this:

Elixir 1.13.4 (compiled with Erlang/OTP 24)

Assuming you use asdf as the version manager, make sure you have the proper version installed:

$ asdf list all elixir
...
1.13.4
1.13.4-otp-22
1.13.4-otp-23
1.13.4-otp-24
1.13.4-otp-25
...

You need the one, compiled with OTP25, meaning

$ asdf install elixir 1.13.4-otp-25
$ asdf global elixir 1.13.4-otp-25

would do.

Metonym answered 6/7, 2022 at 11:33 Comment(2)
Also asdf plugin add elixir could be required if it's the first time asdf is installedHakon
Also, on macOS, need to add "export PATH=~/.asdf/shims:$PATH" into "/.zshrc"Hakon
R
5

Replacing Elixir with a version compiled by Erlang/OTP 25 did not quite do the trick for me. I had to also reinstall rebar. Which I guess was what the message told me in the first place...

➜  notifier mix compile
=ERROR REPORT==== 29-Aug-2022::14:31:31.718410 ===
beam/beam_load.c(148): Error loading module rebar3:
  please re-compile this module with an Erlang/OTP 25 compiler


escript: exception error: undefined function rebar3:main/1
  in function  escript:run/2 (escript.erl, line 750)
  in call from escript:start/1 (escript.erl, line 277)
  in call from init:start_em/1
  in call from init:do_boot/3
** (Mix) Could not compile dependency :telemetry, "/Users/tblevins/.mix/rebar3 bare compile --paths /Users/tblevins/Projects/Sites/Phoenix/personal/notifier/_build/dev/lib/*/ebin" command failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile telemetry", update it with "mix deps.update telemetry" or clean it with "mix deps.clean telemetry"
➜  notifier elixir --version
Erlang/OTP 25 [erts-13.0.4] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit:ns] [dtrace]

Elixir 1.13.4 (compiled with Erlang/OTP 25)

I had to reinstall rebar with mix local.rebar

Github Thread Source

Rapine answered 29/8, 2022 at 18:39 Comment(0)
B
1

I instead downgraded homebrew's erlang package:

$ brew uninstall --ignore-dependencies erlang
$ brew install erlang@24
$ PATH="/opt/homebrew/opt/erlang@24/bin:$PATH"
$ elixir --version
Erlang/OTP 24 [erts-12.3.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [dtrace]

Elixir 1.13.4 (compiled with Erlang/OTP 24)
Boisterous answered 15/8, 2022 at 11:6 Comment(0)
O
1

Looks like OTP 25 is not quite ready with Elixir. There is a open issue for OTP 25 support.

https://github.com/elixir-lang/elixir/issues/11220

Opulence answered 30/8, 2022 at 7:12 Comment(1)
This is by no means an issue for OTP25 support. Elixir is perfectly ready for OTP25.Metonym

© 2022 - 2024 — McMap. All rights reserved.