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

Where Next?

Popular in Questions Top

New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
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
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New

Other popular topics Top

marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
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
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
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
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
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 53690 245
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36128 110
New

We're in Beta

About us Mission Statement