asdf-vm / asdf-elixir

Elixir plugin for asdf version manager
https://github.com/asdf-vm/asdf
MIT License
473 stars 70 forks source link

Got different compiler versions comparing elixir and erlang compilers #108

Closed lovebes closed 2 years ago

lovebes commented 2 years ago

I found this issue happening while working to learn nerves. What I faced is something like this elixirforum post.

My environment:

I have no other OTP versions in my system other than 24 as stated above.

Since I'm running Mojave, I've been having glu.h errors. Therefore I've been successful disabling wx to get asdf erlang to compile, via following custom KERL environment config:

export KERL_CONFIGURE_OPTIONS=\"--with-ssl=\`brew --prefix openssl@1.1\` \
                               --without-wx \
                               --without-javac\"
asdf install erlang 24.1.5
asdf install elixir 1.12.3

Even outside of nerves, I was able to reproduce the issue, just by going into iex.

nerves code that shows different compiler versions is:

# returns "8.0.3"
erlang_compiler_version = Application.spec(:compiler, :vsn) |> to_string()

{:file, path} = :code.is_loaded(Kernel)
{:ok, {_, [compile_info: compile_info]}} = :beam_lib.chunks(path, [:compile_info])
{:ok, vsn} = Keyword.fetch(compile_info, :version)

# returns "7.5.3" <= problem
elixir_compiler_version = vsn |> to_string()

I looked at the OTP versions and corresponding compiler versions, and found out the corresponding OTP version for compiler 7.5.3 is OTP-22.3.

Can anyone help me why two would be different? I've read that asdf-erlang had a time where it couldn't compile any OTP versions beyond OTP 22, but I have a feeling that's not the case.

I pretty much gave up at this point as my knowledge of erlang and elixir isn't deep, but I wanted to at least report it here so as to gain more insight as to what is happening, and if I can perhaps debug this discrepancy.

Thanks in advance.

lovebes commented 2 years ago

oh wait, is this because of what is in README:

The precompiled packages are built against every officially supported OTP 
version, however if you only specify the elixir version, like 1.4.5, the downloaded 
binaries will be those compiled against the oldest OTP release supported by 
that version.

I'll try again and close this comment when it works :)

lovebes commented 2 years ago

ah okay that was it!!! :D closing issue.