The error
Generated elixir app
==> bootstrap (compile)
error: defmacro var!/2 defines defaults multiple times. Elixir allows defaults to be declared once per definition. Instead of:
def foo(:first_clause, b \\ :default) do ... end
def foo(:second_clause, b \\ :default) do ... end
one should write:
def foo(a, b \\ :default)
def foo(:first_clause, b) do ... end
def foo(:second_clause, b) do ... end
/tmp/elixir-1.15.2/lib/elixir/lib/kernel.ex:4618
Function: 'MACRO-!'/2
error: undef
stacktrace: [{'Elixir.CompileError',exception,
[[{description,
<<"internal error in pass beam_ssa_bool:\nexception error: undefined function 'Elixir.CompileError':exception/1\n in function elixir_errors:raise/3 (src/elixir_errors.erl, line 300)\n in call from elixir_def:store_definition/9 (src/elixir_def.erl, line 283)\n in call from elixir_def:store_definition/10 (src/elixir_def.erl, line 211)\n in call from beam_digraph:in_degree/2 (beam_digraph.erl, line 125)\n in call from beam_ssa_bool:build_mapping/4 (beam_ssa_bool.erl, line 822)\n in call from beam_ssa_bool:build_digraph/3 (beam_ssa_bool.erl, line 805)\n in call from beam_ssa_bool:bool_opt_rewrite/5 (beam_ssa_bool.erl, line 633)">>},
{file,<<"/tmp/elixir-1.15.2/lib/elixir/lib/kernel.ex">>},
{line,0}]],
[]},
{elixir_errors,raise,3,
[{file,"src/elixir_errors.erl"},{line,300}]},
{lists,foreach_1,2,[{file,"lists.erl"},{line,1686}]},
{elixir_erl,load_form,5,[{file,"src/elixir_erl.erl"},{line,440}]},
{elixir_module,'-compile/7-fun-1-',9,
[{file,"src/elixir_module.erl"},{line,186}]},
{elixir_erl_compiler,'-spawn/1-fun-0-',2,
[{file,"src/elixir_erl_compiler.erl"},{line,12}]}]
make: *** [lib/elixir/ebin/Elixir.Kernel.beam] Error 1
What I have tried
- using elixir versions 1.13.4, 1.15.1
- using otp 25.3
- using amazon linux 2.0.20220419.0
All the above scenarios still fail to compile with the same reason
My docker file
FROM amazonlinux:2.0.20230612.0
ENV ELIXIR_VERSION="1.15.2"
ENV OTP_VERSION="26.0"
RUN yum groupinstall -y "Development Tools" && \
yum install -y ncurses-devel openssl-devel jq wget
ENV LANG=en_US.UTF-8 \
LANGUAGE=en_US:en \
LC_ALL=en_US.UTF-8 \
PATH="${PATH}:/usr/local/bin"
RUN mkdir -p tmp && \
cd tmp && \
wget -O "/tmp/erlang.tar.gz" "http://erlang.org/download/otp_src_${OTP_VERSION}.tar.gz" && \
tar xfz erlang.tar.gz && \
cd "otp_src_${OTP_VERSION}" && \
./configure && \
make && make install
# Elixir install
RUN cd tmp && \
wget -O "/tmp/elixir.tar.gz" "https://github.com/elixir-lang/elixir/archive/v${ELIXIR_VERSION}.tar.gz" && \
tar xfz elixir.tar.gz && \
cd "elixir-${ELIXIR_VERSION}" && \
make && make install clean
Edit
I am using an M1 macos with 13.4.1 Ventura