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

RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
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
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New

Other popular topics Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
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
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
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New

We're in Beta

About us Mission Statement