What is the difference between elixir 1.7.3 and 1.7.3-opt-21?

Background

When I started with elixir I installed it via asdf.
Like many, I just checked the latest version was 1.7.3 and then I executed asdf install elixir 1.7.3 followed by asdf install erlang 21.1.

And it worked fine… until I needed to use dialyxir.

Problem

Turns out dialyxir doesn’t like elixir 1.7.3 - it is missing a lot core erlang dependencies somehow. To fix this issue I had to run asdf install elixir 1.7.3-otp-21 and set it as the default installation for everything.

Questions

To me this is confusing.

  1. Since I have erlang installed, why do I need this special elixir otp version?
  2. If I just install the 1.7.3-otp-21 version, do I even need to install erlang via asdf?
  3. Should I always use the opt version, or rely on the standard 1.7.3 version?
  4. What are the differences between the 2 and why would I pick one over the other ( without counting that I need the otp version for dialyzer )
1 Like

asdf installs both from prebuilt archives.

In general, the precompiled version without any qualification is built with the lowest supported version of OTP, those that have a qualifier are built with the qualified OTP version.

An elixir compiled with OTP X can not use features of OTP X+1 (or needs to simulate them in a less efficient way).

Usually it is enough to simply install the unqualfied version and it works for local development as is, but for better efficiency one should use matching versions for deployments.

Only if you want to use dialyzer, and you have an erlang OTP installed that is equal to or greater than 20, then you need to have an elixir that is also compiled on 20 or newer. This is due to internal handling of debug information in the compiled modules is handled.

Just search the forum a bit, I’m pretty sure that the full issue is explained in here, or at least a detailed explanation was linked… I’d do it for you if I weren’t on my mobile right now.

6 Likes