[erlang-questions] beginner: dialyzer for the first time

Kostis Sagonas <>
Thu Sep 15 11:14:14 CEST 2011


On 09/15/11 11:50, Bengt Kleberg wrote:
>
> When I want to use dialyzer on some Erlang source files for the first
> time I do:
> dialyzer  --src *erl
>
> This gives me the error:
>    Checking whether the PLT /home/<user>/.dialyzer_plt is
> up-to-date...dialyzer: exit 1
>
> dialyzer: Could not find the PLT: /home/<user>/.dialyzer_plt
> Use the options:
>     --build_plt   to build a new PLT; or
>     --add_to_plt  to add to an existing PLT
>
>
> So I try:
> dialyzer --build_plt  --src *erl
>
> This gives me the error:
> dialyzer: {dialyzer_error,"Byte code compiled with debug_info is needed
> to build the PLT"}
> ...
>
> What should I do next? The goal is to use dialyzer on some Erlang source
> files.

You have misunderstood the (main) purpose of the PLT. It is intended to 
contain type information for modules of the Erlang standard library (so 
that this information is known to the analysis), not the files you want 
to analyze. The message you get is more helpful in later versions (e.g. 
R13B*) and reads as follows:

=======================================================================
dialyzer: Could not find the PLT: /home/USER/.dialyzer_plt
Use the options:
    --build_plt   to build a new PLT; or
    --add_to_plt  to add to an existing PLT

For example, use a command like the following:
    dialyzer --build_plt --apps erts kernel stdlib mnesia
Note that building a PLT such as the above may take 20 mins or so

If you later need information about other applications, say crypto,
you can extend the PLT by the command:
   dialyzer --add_to_plt --apps crypto
For applications that are not in Erlang/OTP use an absolute file name.
=======================================================================

Execute the line:

   dialyzer --build_plt --apps erts kernel stdlib

first and then you can analyze your files in the way you started:

   dialyzer --src *.erl

Kostis



More information about the erlang-questions mailing list