elixir-lang / elixir

Elixir is a dynamic, functional language for building scalable and maintainable applications
https://elixir-lang.org/
Apache License 2.0
24.52k stars 3.38k forks source link

Both 1.14.5 and 1.15.0-rc0 with OTP-26 compilation hang on Windows #12589

Closed edwardzhou closed 1 year ago

edwardzhou commented 1 year ago

Elixir and Erlang/OTP versions

Erlang/OTP 26 [erts-14.0] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]

Elixir 1.14.5 (compiled with Erlang/OTP 25)

Erlang/OTP 26 [erts-14.0] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]

Elixir 1.15.0-rc.0 (3cdb388) (compiled with Erlang/OTP 26)

Operating system

Windows 10 64bit

Current behavior

C:\work\dms_nerves\dms_ui>iex -S mix Erlang/OTP 26 [erts-14.0] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]

==> uniq Compiling 4 files (.ex) Generated uniq app ==> logger_file_backend Compiling 1 file (.ex) Generated logger_file_backend app ==> file_system Compiling 7 files (.ex) Generated file_system app ==> combine Compiling 6 files (.ex) Generated combine app ==> mime Compiling 1 file (.ex) Generated mime app

^^^^^^ hang on here.

Expected behavior

should able to compile all libraries and enter iex

josevalim commented 1 year ago

Can you provide a mix.exs that reproduces the issue? It can be just your listing of def deps. Thanks!

wojtekmach commented 1 year ago

If you can reproduce this with an Mix.install(...), even better.

edwardzhou commented 1 year ago

Can you provide a mix.exs that reproduces the issue? It can be just your listing of def deps. Thanks!

dms_ui deps:

  defp deps do
    [
      {:phoenix, "~> 1.7.2"},
      {:phoenix_html, "~> 3.3"},
      {:phoenix_live_reload, "~> 1.2", only: :dev},
      {:phoenix_live_view, "~> 0.18.16"},
      {:floki, ">= 0.30.0", only: :test},
      {:phoenix_live_dashboard, "~> 0.7.2"},
      {:esbuild, "~> 0.7", runtime: Mix.env() == :dev},
      {:tailwind, "~> 0.2.0", runtime: Mix.env() == :dev},
      {:telemetry_metrics, "~> 0.6"},
      {:telemetry_poller, "~> 1.0"},
      {:gettext, "~> 0.20"},
      {:jason, "~> 1.2"},
      {:plug_cowboy, "~> 2.5"},
      {:dms_engine, path: "../dms_engine", env: Mix.env()}
    ]
  end

dms_engine's deps

  # Run "mix help deps" to learn about dependencies.
  defp deps do
    [
      # {:circuits_gpio, "~> 1.0"},
      # {:circuits_i2c, "~> 1.1"}, #, targets: @all_targets},
      # {:circuits_uart, "~> 1.5.1"}, #, targets: @all_targets},
      # {:circuits_spi, "~> 1.3"}, # targets: @all_targets},
      {:jason, "~> 1.2"},
      {:uniq, "~> 0.1"},
      {:nanoid, "~> 2.0.5"},
      {:net_address, "~> 0.3"},
      {:mac_address, "~> 0.0.0"},
      {:logger_file_backend, "~> 0.0.13"},
      {:timex, "~> 3.7"}
      # {:dep_from_hexpm, "~> 0.3.0"},
      # {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"}
    ]
  end
edwardzhou commented 1 year ago

If you can reproduce this with an Mix.install(...), even better.

it is weird that Mix.install works in iex.


C:\work\dms_nerves\dms_ui>iex
Erlang/OTP 26 [erts-14.0] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]

Interactive Elixir (1.14.5) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> Mix.install [{:mime, "~> 2.0.3"}]
Resolving Hex dependencies...
Resolution completed in 0.019s
New:
  mime 2.0.3
* Getting mime (Hex package)
==> mime
Compiling 1 file (.ex)
Generated mime app
:ok
iex(2)>

but hangs everytime mix compile or iex -S mix. even after deleted _build by 'rm -rf _build'.

edwardzhou commented 1 year ago

I reproduced the same easily with clean Windows 11.

step1. download and install OTP26 https://github.com/erlang/otp/releases/download/OTP-26.0/otp_win64_26.0.exe

step2. download and extract elixir-1.15.0-rc0 from https://github.com/elixir-lang/elixir/releases/download/v1.15.0-rc.0/elixir-otp-26.zip

step3. enter command-line

set set PATH="c:\Program Files\Erlang OTP\bin";c:\work\elixir-otp-26\bin;%PATH%
C:\temp>elixir -v
Erlang/OTP 26 [erts-14.0] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]

Elixir 1.15.0-rc.0 (3cdb388) (compiled with Erlang/OTP 26)

# install phoenix creator 1.7.2
mix archive.install hex phx_new

mix phx.new demo

cd demo
mix deps.get
mix compile

~~~~~~ hang ~~~~~~
simonmcconnell commented 1 year ago

I've seen something similar.

Erlang/OTP 26 [erts-14.0] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit:ns]

Elixir 1.14.4 (compiled with Erlang/OTP 25)
scoop install erlang@26.0-rc3
scoop install elixir@1.14.4-otp-25
scoop install extras/vcredist2022

Then go into my project directory and:

❯ mix compile
==> file_system
Compiling 7 files (.ex)
Generated file_system app
==> decimal
Compiling 4 files (.ex)
Generated decimal app
==> mime
Compiling 1 file (.ex)
Generated mime app
==> x509
Compiling 23 files (.ex)
Generated x509 app
==> ex2ms
Compiling 1 file (.ex)
Generated ex2ms app
==> nimble_options
Compiling 3 files (.ex)
Generated nimble_options app

It sits there forever.

Under OTP 25.3:

❯ mix compile
==> file_system
Compiling 7 files (.ex)
Generated file_system app
==> decimal
Compiling 4 files (.ex)
Generated decimal app
==> mime
Compiling 1 file (.ex)
Generated mime app
==> x509
Compiling 23 files (.ex)
Generated x509 app
==> ex2ms
Compiling 1 file (.ex)
Generated ex2ms app
==> nimble_options
Compiling 3 files (.ex)
Generated nimble_options app
===> Analyzing applications...
===> Compiling unicode_util_compat
===> Analyzing applications...
===> Compiling idna
===> Analyzing applications...
===> Compiling telemetry
==> telemetry_metrics
Compiling 7 files (.ex)
Generated telemetry_metrics app
===> Analyzing applications...
===> Compiling telemetry_poller
==> parent
Compiling 13 files (.ex)
Generated parent app
==> recon
Compiling 6 files (.erl)
Generated recon app
==> jason
Compiling 10 files (.ex)
Generated jason app
==> sobelow
Compiling 51 files (.ex)
Generated sobelow app
==> comeonin
Compiling 4 files (.ex)
Generated comeonin app
==> db_connection
Compiling 15 files (.ex)
Generated db_connection app
==> phoenix_pubsub
Compiling 11 files (.ex)
Generated phoenix_pubsub app
==> plug_crypto
Compiling 5 files (.ex)
Generated plug_crypto app
==> hpax
Compiling 4 files (.ex)
Generated hpax app
===> Analyzing applications...
===> Compiling mimerl
==> jose
Compiling 112 files (.erl)
Compiling 8 files (.ex)
Generated jose app
===> Analyzing applications...
===> Compiling ranch
==> ssl_verify_fun
Compiling 7 files (.erl)
Generated ssl_verify_fun app
===> Analyzing applications...
===> Compiling certifi
==> ecto
Compiling 56 files (.ex)
Generated ecto app
==> plug
Compiling 1 file (.erl)
Compiling 40 files (.ex)
Generated plug app
==> phoenix_html
Compiling 9 files (.ex)
Generated phoenix_html app
==> phoenix_template
Compiling 4 files (.ex)
Generated phoenix_template app
===> Analyzing applications...
===> Compiling parse_trans
==> ecto_sql
Compiling 25 files (.ex)
Generated ecto_sql app
==> nimble_pool
Compiling 2 files (.ex)
Generated nimble_pool app
===> Analyzing applications...
===> Compiling metrics
===> Analyzing applications...
===> Compiling hackney
==> plug_canonical_host
Compiling 1 file (.ex)
Generated plug_canonical_host app
==> castore
Compiling 1 file (.ex)
Generated castore app
==> esbuild
Compiling 3 files (.ex)
Generated esbuild app
==> tailwind
Compiling 3 files (.ex)
Generated tailwind app
==> mint
Compiling 1 file (.erl)
Compiling 19 files (.ex)
Generated mint app
==> finch
Compiling 13 files (.ex)
Generated finch app
==> elixir_make
Compiling 6 files (.ex)
Generated elixir_make app
...

Same issue on 1.14.[4|5]-otp-2[5|6] + otp-26. Fine on OTP 25.

I tried 1.15.0-rc.0-otp-2[5|6] + otp-26 but x509 blew up before I get to where it usually hangs.

❯ mix compile
==> file_system
Compiling 7 files (.ex)
Generated file_system app
==> decimal
Compiling 4 files (.ex)
Generated decimal app
==> mime
Compiling 1 file (.ex)
Generated mime app
==> x509
Compiling 23 files (.ex)
warning: Logger.warn/1 is deprecated. Use Logger.warning/2 instead
  lib/x509/test/suite.ex:585: X509.Test.Suite.sni_handler/2

warning: Logger.warn/1 is deprecated. Use Logger.warning/2 instead
  lib/x509/test/crl_server.ex:110: X509.Test.CRLServer.flush_headers/3

== Compilation error in file lib/x509/asn1.ex ==
** (UndefinedFunctionError) function :epp_dodger.parse_file/1 is undefined (module :epp_dodger is not available)
    :epp_dodger.parse_file(~c"c:/Users/simon/scoop/apps/erlang/26.0/lib/public_key-1.14/include/OTP-PUB-KEY.hrl")
    lib/x509/asn1/oid_import.ex:19: X509.ASN1.OIDImport.get_oids/1
    lib/x509/asn1.ex:84: (module)
could not compile dependency :x509, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile x509 --force", update it with "mix deps.update x509" or clean it with "mix deps.clean x509"
josevalim commented 1 year ago

This is an issue with Erlang/OTP 26 manifested through Rebar3: https://github.com/erlang/otp/issues/7261

A temporary fix for Rebar3 has been sent here: https://github.com/erlang/rebar3/pull/2794

It is not an Elixir issue, but I will keep this open for guidance. Thanks for the reports!

josevalim commented 1 year ago

There is a new Rebar3 out and mix local.rebar should install it by default from now on!