Phoenix: Cowlib 2.9.1 won't compile with phoenix

Created on 12 Jun 2020  Â·  2Comments  Â·  Source: phoenixframework/phoenix

Environment

  • Elixir version (elixir -v):
Erlang/OTP 21 [erts-10.1] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1]
Elixir 1.8.1 (compiled with Erlang/OTP 20)
  • Phoenix version (mix deps):
{:phoenix, "~> 1.4.0"}
  • Operating system:
sw_vers
ProductName:    Mac OS X
ProductVersion: 10.15.4
BuildVersion:   19E287

Expected behavior

mix deps.compile cowboy
===> Compiling cowboy

Actual behavior

mix deps.compile cowboy
===> Compiling cowboy
Function: request_process/3
===> Compiling src/cowboy_stream_h.erl failed
src/cowboy_stream_h.erl:none: internal error in sys_core_dsetel;
crash reason: {case_clause,
    {'EXIT',
        {{case_clause,
             #{0 => 1,1 => 1,2 => 1,4 => 1,5 => 1,6 => 1,10 => 0,
               'Reason' => 1}},
         [{sys_core_dsetel,visit,2,[{file,"sys_core_dsetel.erl"},{line,98}]},
          {lists,mapfoldl,3,[{file,"lists.erl"},{line,1354}]},
          {lists,mapfoldl,3,[{file,"lists.erl"},{line,1355}]},
          {sys_core_dsetel,visit,2,[{file,"sys_core_dsetel.erl"},{line,188}]},
          {lists,mapfoldl,3,[{file,"lists.erl"},{line,1354}]},
          {lists,mapfoldl,3,[{file,"lists.erl"},{line,1355}]},
          {sys_core_dsetel,visit,2,[{file,"sys_core_dsetel.erl"},{line,188}]},
          {sys_core_dsetel,visit,2,
              [{file,"sys_core_dsetel.erl"},{line,144}]}]}}}

  in function  compile:'-select_passes/2-anonymous-2-'/3 (compile.erl, line 585)
  in call from compile:'-internal_comp/5-anonymous-1-'/3 (compile.erl, line 349)
  in call from compile:fold_comp/4 (compile.erl, line 376)
  in call from compile:internal_comp/5 (compile.erl, line 360)
  in call from compile:'-do_compile/2-anonymous-0-'/2 (compile.erl, line 177)
  in call from compile:'-do_compile/2-anonymous-1-'/1 (compile.erl, line 190)

Not sure if this is the correct place to post this, or if it belongs in the cowboy / cowlib repos.

Workaround

Add cowlib 2.8.0 to mix.exs file to lock in on the correct version.

{:cowlib, "~> 2.8.0"}

or manually add it to your mix.lock file

"cowlib": {:hex, :cowlib, "2.8.0", "fd0ff1787db84ac415b8211573e9a30a3ebe71b5cbff7f720089972b2319c8a4", [:rebar3], [], "hexpm"}

Also referenced on this elixir forum

I'm not sure where or how this should be addressed. Phoenix lists plug_cowboy as an optional dependency and plug_cowboy is pulling in cowboy ~> 2.7 I think if plug_cowboy were updated to not pull in cowboy 2.8.0 (cowboy ~> 2.7.0) that that would resolve the issue, but I'm not sure that that is the correct approach.

I think an alternative solution would be that phoenix could add cowlib ~> 2.8.0 as an optional dependency. My thought is that phoenix should ultimately be responsible for the fact that an incompatible version of one of its dependencies, even if it is optional and transitive, is not allowed.

¯\_(ツ)_/¯

open for guidance

Most helpful comment

For those running into this, recent cowboy versions require Erlang/OTP 21.3 or later. So please update your Erlang or add {:cowlib, "~> 2.8.0"} to your mix.exs.

All 2 comments

For those running into this, recent cowboy versions require Erlang/OTP 21.3 or later. So please update your Erlang or add {:cowlib, "~> 2.8.0"} to your mix.exs.

I'm still running into this issue with Erlang/OTP 23 and a completely fresh mix phx.new project.

$ elixir -v
Erlang/OTP 23 [erts-11.1.7] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]

Elixir 1.11.2 (compiled with Erlang/OTP 23)

I get this when running mix deps.build:

===> Compiling cowlib
===> Compiling src/cow_http.erl failed
src/cow_http.erl:39: can't find include file "cow_inline.hrl"
src/cow_http.erl:192: undefined macro 'LOWER/4'

src/cow_http.erl:185: function parse_hd_name/3 undefined

src/cow_http.erl:195: Warning: function parse_hd_name_ws/3 is unused
src/cow_http.erl:202: Warning: function parse_hd_before_value/3 is unused
src/cow_http.erl:209: Warning: function parse_hd_value/4 is unused
src/cow_http.erl:221: Warning: function clean_value_ws_end/2 is unused

I added {:cowlib, "~> 2.8.0"} to my mix.exs.

Running Ubuntu 18.04.5 LTS on WSL 2.

Was this page helpful?
0 / 5 - 0 ratings