我想通过python应用程序使用Frama-c。这个python应用程序设置了一些env变量和系统路径。从这个应用程序,我打电话邮资-C作为一个python程序如下:OCaml引发的“无子进程”错误Sys.command函数
cmd = ['/usr/local/bin/frama-c', '-wp', '-wp-print', '-wp-out', '/home/user/temp','/home/user/project/test.c']
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=False)
当这个代码是从Python应用程序我收到以下错误执行:
[kernel] Parsing FRAMAC_SHARE/libc/__fc_builtin_for_normalization.i (no preprocessing)
[kernel] warning: your preprocessor is not known to handle option ` -nostdinc'. If pre-processing fails because of it, please add -no-cpp-gnu-like option to Frama-C's command-line. If you do not want to see this warning again, use explicitely -cpp-gnu-like option.
[kernel] warning: your preprocessor is not known to handle option `-dD'. If pre-processing fails because of it, please add -no-cpp-gnu-like option to Frama-C's command-line. If you do not want to see this warning again, use explicitely -cpp-gnu-like option.
[kernel] Parsing 2675891095.c (with preprocessing)
[kernel] System error: /usr/bin/gcc -c -C -E -I. -dD -nostdinc -D__FC_MACHDEP_X86_32 -I/usr/local/share/frama-c/libc -o '/tmp/2675891095.cc8bf16.i' '/home/user/project/test.c': No child processes
我很难找到它调试是什么造成的错误:
System error: /usr/bin/gcc -c -C -E -I. -dD -nostdinc -D__FC_MACHDEP_X86_32 -I/usr/local/share/frama-c/libc -o '/tmp/2675891095.cc8bf16.i' '/home/user/project/test.c': No child processes
有没有办法从Frama-c生成更多的错误日志,可以帮助我找出问题?
请注意,只有当我从我的应用程序启动进程(执行Frama-c)时才会出现此错误,而不是从python控制台启动它。它只发生在Linux机器而不是Windows机器上。
任何帮助表示赞赏。谢谢!!
更新: 我意识到通过使用-kernel-debug标志我可以获得堆栈跟踪。所以,我想的选项,并获得以下信息:
Fatal error: exception Sys_error("gcc -E -C -I. -dD -D__FRAMAC__ -nostdinc -D__FC_MACHDEP_X86_32 -I/usr/local/share/frama-c/libc -o '/tmp/2884428408.c2da79b.i' '/home/usr/project/test.c': No child processes")
Raised by primitive operation at file "src/kernel_services/ast_queries/file.ml", line 472, characters 9-32
Called from file "src/kernel_services/ast_queries/file.ml", line 517, characters 14-26
Called from file "src/kernel_services/ast_queries/file.ml", line 703, characters 46-59
Called from file "list.ml", line 84, characters 24-34
Called from file "src/kernel_services/ast_queries/file.ml", line 703, characters 17-76
Called from file "src/kernel_services/ast_queries/file.ml", line 1587, characters 24-47
Called from file "src/kernel_services/ast_queries/file.ml", line 1667, characters 4-27
Called from file "src/kernel_services/ast_data/ast.ml", line 108, characters 2-28
Called from file "src/kernel_services/ast_data/ast.ml", line 116, characters 53-71
Called from file "src/kernel_internals/runtime/boot.ml", line 29, characters 6-20
Called from file "src/kernel_services/cmdline_parameters/cmdline.ml", line 787, characters 2-9
Called from file "src/kernel_services/cmdline_parameters/cmdline.ml", line 817, characters 18-64
Called from file "src/kernel_services/cmdline_parameters/cmdline.ml", line 228, characters 4-8
Re-raised at file "src/kernel_services/cmdline_parameters/cmdline.ml", line 244, characters 12-15
Called from file "src/kernel_internals/runtime/boot.ml", line 72, characters 2-127
而且我看了看文件"src/kernel_services/ast_queries/file.ml", line 472
和执行的代码是Sys.command cpp_command
。
我不确定为什么在尝试执行执行gcc时会抛出“No Child Processes”错误。
更新:我有ocaml的版本:4.02.3,Python版本:2.7.8和邮资-C版本:硅20161101
它可能有助于知道你在哪个系统上运行:Linux,Windows,macOS? –
它仅在Linux机器上发生,而不在Windows机器上发生。 – user2888308
你还可以指定你正在使用的OCaml和Python的版本吗?有一些相关问题(如[this one](https://caml.inria.fr/mantis/view.php?id=5256))仅适用于特定版本的Python和/或OCaml。 – anol