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 Issues · jeremyjh/dialyxir · GitHub 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

Last Post!

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

lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
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
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

Other popular topics Top

JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 55125 245
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
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement