Fl4m3Ph03n1x

Fl4m3Ph03n1x

Dialyzer not compiling correctly

Background

I am trying dialyxir to find out if it is worth it, however I have a bunch of errors on the compile phase and I want to fix them.

What did you do?

Created a pet project to try out dialyzer with dialyxir.

  1. mix new dialzyer_project
  2. cd dialyzer_project
  3. Install dialyxir globally
  4. Added the dialyxir dependency
  5. mix dialyzer

After this, I see a ton of red messages on my screen:

Finding suitable PLTs
Checking PLT...
[:compiler, :elixir, :kernel, :logger, :stdlib]
Looking up modules in dialyxir_erlang-21.1_elixir-1.7.3_deps-dev.plt
Looking up modules in dialyxir_erlang-21.1_elixir-1.7.3.plt
Finding applications for dialyxir_erlang-21.1_elixir-1.7.3.plt
Finding modules for dialyxir_erlang-21.1_elixir-1.7.3.plt
Checking 185 modules in dialyxir_erlang-21.1_elixir-1.7.3.plt
Adding 230 modules to dialyxir_erlang-21.1_elixir-1.7.3.plt
:dialyzer.run error: Analysis failed with error:
Could not scan the following file(s):
  Could not get Core Erlang code for: /home/fl4m3/.asdf/installs/elixir/1.7.3/lib/elixir/ebin/elixir_tokenizer.beam
  Recompile with +debug_info or analyze starting from source code  Could not get Core Erlang code for: /home/fl4m3/.asdf/installs/elixir/1.7.3/lib/elixir/ebin/elixir_parser.beam
  Recompile with +debug_info or analyze starting from source code  Could not get Core Erlang code for: /home/fl4m3/.asdf/installs/elixir/1.7.3/lib/elixir/ebin/elixir_utils.beam
... 

Seems that every possible Erlang package has this issue.
But astonishingly enough, the command still analyses the project and still shows errors. I have installed erlang and elixir using asdf.

Question

How can I fix the compile errors?

Marked As Solved

Fl4m3Ph03n1x

Fl4m3Ph03n1x

Fixed the issue. Turns out I had a lingering version of dialyxir isntalled globally with asdf elixir 1.7.3-otp-21 . I had to go to ~/.asdf/installs/elixir/1.7.3-otp-21/.mix/archives and manually delete the dialyxir folder.

Once I did that, everything worked out perfectly. So as a cautionary tale of advise for future readers, never install dialyxr locally and globally.

If you have dialyxir installed globally, make sure none of your projects has a local reference to it, or you will be in for a world of pain.

Special thanks to @NobbZ for helping out with the Git issue.

Also Liked

jeremyjh

jeremyjh

You need to asdf local elixir 1.7.3-otp-21.

That will get you the Elixir that is precompiled with the correct version of OTP.

NobbZ

NobbZ

Please try again with master, if the error remains please file a bug report at https://github.com/jeremyjh/dialyxir/issues and use one of the older RCs until the issue has been resolved and a new release (candidate) is available.

slashdotdash

slashdotdash

Thanks for the tip @jeremyjh.

I’ve been struggling with Dialyzer usage and didn’t realise it was because I needed to install the appropriate Elixir/OTP version when using asdf (as below).

asdf install erlang 21.1.1
asdf install elixir 1.7.4-otp-21
asdf global erlang 21.1.1
asdf global elixir 1.7.4-otp-21
NobbZ

NobbZ

Well, except for very few exceptions, do not use mix archive.install at all.

This is why I also PR’d and removed global installation instructions from the README.

Where Next?

Popular in Questions Top

dotdotdotPaul
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
pgiesin
This should be a simple problem but I just can’t seem to figure it out. I have a standalone Elixir app that won’t find the database. Dep...
New
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
dokuzbir
Hello, I am trying to convert my lists to string without losing brackets.For start i have 3 map. They look like these buyer = %{ id: ...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
LegitStack
I’m trying to make a websocket server in Phoenix or raw Elixir. I heard about gun, I think I could use cowboy, but since I’m not that sma...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New

Other popular topics Top

yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
273 38985 115
New

We're in Beta

About us Mission Statement