elixir-plug / plug

Compose web applications with functions
https://hex.pm/packages/plug
Other
2.85k stars 586 forks source link

Compilation issues on Erlang 26.x #1207

Closed midas closed 8 months ago

midas commented 8 months ago

Description

When compiling plug on Erlang 26.x (specifically 26.2.1 and 26.0.2) an error is raised:

==> plug
Compiling 1 file (.erl)
Compiling 40 files (.ex)

== Compilation error in file lib/plug/conn/utils.ex ==
** (ArgumentError) invalid right argument for operator "in", it expects a compile-time proper list or compile-time range on the right side when used in guard expressions, got: %{first: 65, last: 90, __struct__: Range, step: 1}
    (elixir 1.13.4) lib/kernel.ex:4245: Kernel.raise_on_invalid_args_in_2/1
    (elixir 1.13.4) expanding macro: Kernel.in/2
    lib/plug/conn/utils.ex:64: Plug.Conn.Utils.mt_first/2

Instructions to Reproduce

Assuming you manage your Erlang and Elixir version with asdf.

mix new compile_plug && cd compile_plug
echo 'erlang 26.2.1\nelixir 1.13.4\n' >> .tool-versions

Next, add {:plug, "~> 1.5"} to the depssection of the mix.exs file.

Finally run the following: mix deps.get && mix compile

The error documented above will be output to your console.

josevalim commented 8 months ago

Elixir v1.13.4 does not support Erlang/OTP 26. You must upgrade to Elixir 1.15 at least. Check out the table here: https://hexdocs.pm/elixir/compatibility-and-deprecations.html#between-elixir-and-erlang-otp

josevalim commented 8 months ago

Or v1.14.5.

midas commented 8 months ago

Hi Jose! Thanks for the info. It is strange that there is a precompiled Elixir 1.13.4 for OTP 26 available. I noticed that there is not a precompiled Elixir 1.14.x, 1.15.x or 1.16.x for OTP 26. This is what led me down the wrong path. Hope you are well!