使用 Frama-Clang 插件时出错
Errors when using the Frama-Clang plugin
鉴于插件 https://frama-c.com/frama-clang.html 被认为是在开发的"早期阶段",也许我现在不走运。但是想知道是否有其他人遇到过这样的问题:
navarre@navarre-t400:~/code/c$ frama-c max.cpp
[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing)
[kernel] Parsing max.cpp (external front-end)
: CommandLine Error: Option 'asm-macro-max-nesting-depth' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options
[kernel] user error: Failed to parse C++ file. See Clang messages for more information
[kernel] user error: stopping on file "max.cpp" that has errors.
[kernel] Frama-C aborted: invalid user input.
作为记录,max.cpp的内容如下:
int s(int i) {
return i;
}
任何帮助将不胜感激。甚至只是将我指向错误输出表明我看到的神秘"Clang 消息"!
编辑:我可能应该补充一点,我在 Ubuntu 上,并且有相当长的时间让构建工作,显然是由于 Ubuntu 的存储库与 PPA 中的 clang 3.9 冲突。我最终得到了插件来构建,现在我被困在这里。
编辑2:我能够编辑frama_Clang_register.ml的源代码以查看正在运行的命令。是这个:
framaCIRGen -target i386-unknown-linux-gnu -D__FC_MACHDEP_X86_32 -std=c++11 -nostdinc -I /home/navarre/.opam/system/share/frama-c/frama-clang/libc++ -I /home/navarre/.opam/system/share/frama-c/libc -I /home/navarre/.opam/system/share/frama-c --stop-annot-error
所以现在的问题变成了"'framaCIRGen'有什么问题。首先,我注意到即使我只是运行framaCIRGen而不是其他任何东西,我也会收到令人反感的错误。有趣。
然后我注意到有问题的东西是(asm-macro-max-nesting-depth(不存在于framaCIRGen的源文件中,而是在编译的二进制文件中!
它也不在 cpp 的输出中,所以它一定是通过链接库进入的吗?
navarre@navarre-t400:~/Downloads/frama-clang-0.0.3$ cpp -std=c++11 ./FramaCIRGen.cpp -I/usr/lib/llvm-4.0/include -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -g -fPIC -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS | grep asm-macro-max-nesting-depth | wc
0 0 0
编辑:
以下是 ./configure 的输出:
checking for frama-c-gui... no
checking for Makefile.config.in... yes
frama_clang... yes
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for camlp4o... yes
checking for clang... no
checking for clang-3.8... no
checking for clang-3.9... no
checking for clang-4.0... clang-4.0
checking for clang++... no
checking for clang++-3.8... no
checking for clang++-3.9... no
checking for clang++-4.0... clang++-4.0
checking for llvm-config... no
checking for llvm-config-3.8... no
checking for llvm-config-3.9... no
checking for llvm-config-4.0... llvm-config-4.0
checking LLVM version... 4.0.1: Good
configure: frama_clang: yes
configure: creating ./config.status
config.status: creating ./Makefile.config
这是make的输出(环境变量VERBOSEMAKE=yes(。
Generating .Makefile.plugin.generated
Generating intermediate AST
Generating top/Frama_Clang.mli
Ocamldep ./.depend
Ocamlc intermediate_format.cmi
Ocamlc intermediate_format_parser.cmi
Ocamlc intermediate_format_parser.cmo
Ocamlc frama_Clang_option.cmi
Ocamlc frama_Clang_option.cmo
Ocamlc fclang_datatype.cmi
Ocamlc fclang_datatype.cmo
Ocamlc cxx_utils.cmi
Ocamlc cxx_utils.cmo
Ocamlc mangling.cmi
Ocamlc mangling.cmo
Ocamlc convert_env.cmi
Ocamlc convert_env.cmo
Ocamlc convert_acsl.cmi
Ocamlc convert_acsl.cmo
Ocamlc generate_spec.cmi
Ocamlc generate_spec.cmo
Ocamlc class.cmi
Ocamlc class.cmo
Ocamlc convert.cmi
Ocamlc convert.cmo
Ocamlc convert_link.cmi
Ocamlc convert_link.cmo
Ocamlc frama_Clang_register.cmi
Ocamlc frama_Clang_register.cmo
Ocamlc Frama_Clang.cmi
Generating top/Frama_Clang.cmi
Packing top/Frama_Clang.cmo
findlib: [WARNING] Interface Frama_Clang.cmi occurs in several directories: /home/navarre/.opam/system/lib/frama-c/plugins, .
Ocamlopt intermediate_format_parser.cmx
findlib: [WARNING] Interface Frama_Clang.cmi occurs in several directories: /home/navarre/.opam/system/lib/frama-c/plugins, .
Ocamlopt frama_Clang_option.cmx
findlib: [WARNING] Interface Frama_Clang.cmi occurs in several directories: /home/navarre/.opam/system/lib/frama-c/plugins, .
Ocamlopt fclang_datatype.cmx
findlib: [WARNING] Interface Frama_Clang.cmi occurs in several directories: /home/navarre/.opam/system/lib/frama-c/plugins, .
Ocamlopt cxx_utils.cmx
findlib: [WARNING] Interface Frama_Clang.cmi occurs in several directories: /home/navarre/.opam/system/lib/frama-c/plugins, .
Ocamlopt mangling.cmx
findlib: [WARNING] Interface Frama_Clang.cmi occurs in several directories: /home/navarre/.opam/system/lib/frama-c/plugins, .
Ocamlopt convert_env.cmx
findlib: [WARNING] Interface Frama_Clang.cmi occurs in several directories: /home/navarre/.opam/system/lib/frama-c/plugins, .
Ocamlopt convert_acsl.cmx
findlib: [WARNING] Interface Frama_Clang.cmi occurs in several directories: /home/navarre/.opam/system/lib/frama-c/plugins, .
Ocamlopt generate_spec.cmx
findlib: [WARNING] Interface Frama_Clang.cmi occurs in several directories: /home/navarre/.opam/system/lib/frama-c/plugins, .
Ocamlopt class.cmx
findlib: [WARNING] Interface Frama_Clang.cmi occurs in several directories: /home/navarre/.opam/system/lib/frama-c/plugins, .
Ocamlopt convert.cmx
findlib: [WARNING] Interface Frama_Clang.cmi occurs in several directories: /home/navarre/.opam/system/lib/frama-c/plugins, .
Ocamlopt convert_link.cmx
findlib: [WARNING] Interface Frama_Clang.cmi occurs in several directories: /home/navarre/.opam/system/lib/frama-c/plugins, .
Ocamlopt frama_Clang_register.cmx
findlib: [WARNING] Interface Frama_Clang.cmi occurs in several directories: /home/navarre/.opam/system/lib/frama-c/plugins, .
Packing top/Frama_Clang.cmx
findlib: [WARNING] Interface Frama_Clang.cmi occurs in several directories: /home/navarre/.opam/system/lib/frama-c/plugins, .
Packing top/Frama_Clang.cmxs
findlib: [WARNING] Interface Frama_Clang.cmi occurs in several directories: /home/navarre/.opam/system/lib/frama-c/plugins, .
make[1]: Entering directory `/home/navarre/Downloads/frama-clang-0.0.3'
Compiling Clang_utils.cpp
Compiling intermediate_format.c
Compiling ACSLComment.cpp
Compiling ACSLLogicType.cpp
Compiling ACSLTermOrPredicate.cpp
Compiling ACSLLoopAnnotation.cpp
Compiling ACSLStatementAnnotation.cpp
Compiling ACSLGlobalAnnotation.cpp
Compiling ACSLCodeAnnotation.cpp
Compiling ACSLFunctionContract.cpp
Compiling ACSLComponent.cpp
Compiling ACSLLexer.cpp
Compiling ACSLParser.cpp
Compiling ACSLToken.cpp
Compiling DescentParse.cpp
Compiling RTTITable.cpp
Compiling VisitTable.cpp
Compiling ClangVisitor.cpp
Compiling FramaCIRGen.cpp
Linking bin/framaCIRGen
make[1]: Leaving directory `/home/navarre/Downloads/frama-clang-0.0.3'
这是评论中建议的调试标志:
navarre@navarre-t400:~/code/c$ frama-c max.cpp -fclang-msg-key clang
[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing)
[kernel] Parsing max.cpp (external front-end)
[fclang:clang] Clang command is framaCIRGen -target i386-unknown-linux-gnu -D__FC_MACHDEP_X86_32 -std=c++11 -nostdinc -I /home/navarre/.opam/system/share/frama-c/frama-clang/libc++ -I /home/navarre/.opam/system/share/frama-c/libc -I /home/navarre/.opam/system/share/frama-c --stop-annot-error -v max.cpp -o /tmp/clang_ast8f7187ast
: CommandLine Error: Option 'asm-macro-max-nesting-depth' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options
framaCIRGen -target i386-unknown-linux-gnu -D__FC_MACHDEP_X86_32 -std=c++11 -nostdinc -I /home/navarre/.opam/system/share/frama-c/frama-clang/libc++ -I /home/navarre/.opam/system/share/frama-c/libc -I /home/navarre/.opam/system/share/frama-c --stop-annot-error -v max.cpp -o /tmp/clang_ast8f7187ast[kernel] user error: Failed to parse C++ file. See Clang messages for more information
[kernel] user error: stopping on file "max.cpp" that has errors.
[kernel] Frama-C aborted: invalid user input.
[extlib] Debug: not removing file /tmp/clang_ast8f7187ast
似乎问题在于我使用的 Ubuntu 软件包的年龄。我能够在另一台运行 16.04 的计算机上成功安装(我的有 14.04(。
我已经升级了我的电脑,现在期待更多的成功。
相关文章:
- 从C++本机插件更新Vector3数组
- 使用CMake创建QML插件
- 访问者访问变体并返回不同类型时出错
- 在Linux for Windows上编译C++代码时出错
- 读取文件的最后一行并输入到链接列表时出错
- 重载操作程序时出错>>用于类中的字符串 memebr
- 调用专用模板时出错"no matching function for call to [...]"
- C++-试图将函数指针推回到另一个CPP文件中的矢量时出错
- LINK 尝试使用 OpenSSL evp aes 256 c++ 时出错
- 在Google Kick start中提交时出错
- 在c++中访问int到类对象的映射时出错
- 分段错误当我试图运行程序时出错
- 使用dynamic_cast和构造函数时出错
- CHECK(调用)函数在Google Colab中出错
- 运行命令 "rosbag play example.bag" 时出错。找不到与插件 rosbag/NoEncryptor 对应的库
- 使用 Frama-Clang 插件时出错
- 凉亭ROS插件出错:建筑x86_64的未定义符号
- 在mac-ld上编译zathura pdf插件出错
- 编译 Qt 插件项目时出错
- 使用Autotools插件从Eclipse调用autoreconf时出错