erlang dialyzer使用

来源:互联网 发布:手机域名是什么 编辑:程序博客网 时间:2024/05/20 18:20

环境:erlang 8.1  windows7 64位  erlang安装在F盘。

构建PLT的过程如下:

F:\erlang\workspace_erlang\spider\src\test\unit9>dialyzer --build_plt --apps ert
s kernel stdlib
 
dialyzer: {dialyzer_error,"The HOME environment variable needs to be set so that
 Dialyzer knows where to find the default PLT"}
[{dialyzer_plt,plt_error,1,[{file,"dialyzer_plt.erl"},{line,588}]},
 {dialyzer_options,build,1,[{file,"dialyzer_options.erl"},{line,57}]},
 {dialyzer_cl_parse,cl,1,[{file,"dialyzer_cl_parse.erl"},{line,229}]},
 {dialyzer_cl_parse,start,0,[{file,"dialyzer_cl_parse.erl"},{line,47}]},
 {dialyzer,plain_cl,0,[{file,"dialyzer.erl"},{line,61}]},
 {init,start_em,1,[{file,"init.erl"},{line,1076}]},
 {init,do_boot,3,[{file,"init.erl"},{line,784}]}]

构建时报错,说找不到HOME环境变量。根据erlang程序设计第九单中的描述,第一次运行dialyzer时,需要为打算使用的所有标准库类型建立缓存。PLT是Persistent Lookup Table(持久性查询表)的缩写。PLT应当包含标准系统里所有类型的缓存。生成PLT需要花费几分钟的时间。 猜测这个HOME变量应该是指向构建PLT的缓存目录。

F:\erlang\workspace_erlang\spider\src\test\unit9>set HOME=F:\erlang\dialyzer

F:\erlang\workspace_erlang\spider\src\test\unit9>echo %HOME%
F:\erlang\dialyzer

F:\erlang\workspace_erlang\spider\src\test\unit9>dialyzer --build_plt --apps ert
s kernel stdlib
  Creating PLT f:/erlang/dialyzer/.dialyzer_plt ...
Unknown functions:
  compile:file/2
  compile:forms/2
  compile:noenv_forms/2
  compile:output_generated/1
  crypto:block_decrypt/4
  crypto:start/0
Unknown types:
  compile:option/0
 done in 1m24.61s
done (passed successfully)

注意:进入dialyzer的构建估计需要很长时间。


0 0