How to use dialyzer with parse transform modules

2019-09-06 20:48发布

问题:

I'm trying to use dialyzer on my erlang application but here's the output :

dialyzer \
        --src -r src \
        -pa /home/niahoo/src/popos \
        -pa /home/niahoo/src/popos/deps/parse_trans \
        --verbose
  Checking whether the PLT c:/MinGW/msys/1.0/home/niahoo/.dialyzer_plt is up-to-date... yes
  Proceeding with analysis...
dialyzer: Analysis failed with error:
Could not scan the following file(s): [{"c:/MinGW/msys/1.0/home/niahoo/src/popos/src/tools/r.erl",
                                        ["c:/MinGW/msys/1.0/home/niahoo/src/popos/src/tools/r.erl:none: undefined parse transform 'exprecs'\n"]},
                                       {"c:/MinGW/msys/1.0/home/niahoo/src/popos/src/game/party2.erl",
                                        ["c:/MinGW/msys/1.0/home/niahoo/src/popos/src/game/party2.erl:none: undefined parse transform 'playerdupli'\n"]}]
Last messages in the log cache:
  Reading files and computing callgraph... 

I tried to put playerdupli.erl in the same directory as party2.erl, but the output is the same. exprecs.erl is in the deps: deps/parse_trans/src.

The code compiles and runs without error, including parse_transform stuff. I'm on MinGW (Windows 8 64). Any idea ?

Thanks

回答1:

An alternative that is always easier, is to compile with +debug_info and let dialyzer analyze the resulting .beam files.



回答2:

So, i should have missed something in the doc. There is the command that works :

dialyzer \
    --src -r src \
    -pa /home/niahoo/src/popos \
    -pa ebin \
    -pa deps/parse_trans/ebin \
    --raw \
    --statistics \

-pa /home/niahoo/src/popos Allows dilayzer to find included .hrl used with include_lib -pa ebin allows to find my parse_transform module (playerdupli) -pa deps/parse_trans/ebin idem. with exprecs