-1

When executing code written here with the command frama-c -load- script cfg_print.ml test.c (cfg_print.ml is the name of the file on my system containg the Ocaml code and test.c is the file containing c code) , I get the following error:

[kernel] user error: command `ocamlopt.opt -shared -o cfg_print.cmxs -w Ly -warn-error A -I /usr/lib/frama-c -I . cfg_print.ml' failed
[kernel] Frama-C aborted because of invalid user input.  

How can I remove this error?

Community
  • 1
  • 1
kbiplav
  • 63
  • 8
  • It's extremely hard to read what you've written here. One thing I see is an extra `>` on the command line. But this may be something that was added in the copy/paste. It would help if you cleaned up your text to be more readable (and an exact copy of what you see). – Jeffrey Scofield Mar 08 '15 at 18:58
  • please help. i am getting the above error when executing the code mentioned in the link @ Jeffrey Scofield – kbiplav Mar 08 '15 at 19:37
  • Unless you're redirecting `stderr`, the exact error message from the OCaml compiler should appear before the message from Frama-C itself. This is the information Jeffrey Scofield is referring to in his answer and that you should provide to us (possibly together with `cfg_print.ml`, as it is often complicated to guess what can go wrong without having the code). – Virgile Mar 09 '15 at 15:29
  • the code i am using is given in the link provided above. As Jeffery said ,it works fine while executing it through terminal , but gives above mentioned error when i tried it executing through php shell_exec function. I am using shell_exec('frama-c -load-script cfg_print.ml'.escapeshellarg(test.c)); @Virgile – kbiplav Mar 10 '15 at 14:11
  • You've not provided the error reported by OCaml as suggested in my previous comment, but based on what I've seen with the code you've given, it seems that you're using a newer version of Frama-C, in which `Ast_printer` has been replaced by `Printer`. Functions names have changed to, from `d_instr` and `d_expr` to `pp_instr` and `pp_expr`, and there's no dereference (`!`) anymore. – Virgile Mar 10 '15 at 16:20
  • On running this command ocamlopt.opt -shared -o cfg_print.cmxs -w Ly -warn-error A -I /usr/lib/frama-c -I . cfg_print.ml on terminal following error is displayed --> File "cfg_print.mltest.ml ", line 1, character 0-1: Warning 24: bad source file name cfg_print.mltest.ml is not a valid module name. – kbiplav Mar 11 '15 at 11:06
  • You cannot have `.` in OCaml module names, hence in filenames. Name your script `cfg_print_mltest.ml`, or something similar. – byako Mar 20 '15 at 15:16
  • i tried to change the name as suggested by you but it does not show any difference, as it is generated by the compiler automatically based on input program name( here test.c), please help how to change default naming @BorisYakobowski – kbiplav Apr 08 '15 at 12:17

1 Answers1

1

I tried your command line on my system and it basically worked OK. It only warned that the directory /usr/lib/frama-c doesn't exist. This isn't surprising as I've never used Frama-C.

Since your command line is basicaly OK, this suggests some of the inputs are wrong. If this is the case, then the compiler ocamlopt.opt should have written some error messages. But no such messages show up here; possibly they've been logged somewhere by your Frama-C development environment. I'd suggest you look for those error messages. Another way to proceed might be to type this command line by hand and see what ocamlopt.opt says.

Jeffrey Scofield
  • 65,646
  • 2
  • 72
  • 108
  • yes, it worked OK on linux terminal, but executing the same thing through php shell_exec() function it gives error.@Jeffrey – kbiplav Mar 10 '15 at 14:23
  • Check your PATH in both environments, perhaps. Generally, you have to see what's different between them. – Jeffrey Scofield Mar 10 '15 at 14:53