OCaml backtrace link

180 views Asked by At

Here is my Makefile

CC = ocamlc
LIBES = str.cma
CFLAGS = -g -c
.PHONY : clean 
dpll:   
    -rm -f dpll
    $(CC) $(CFLAGS) dpll.ml 
    $(CC) -o dpll $(LIBES) dpll.cmo
    make clean
test:   
    ./dpll input.cnf
clean: 
    rm -f *.cmi *.cmo

and my OCaml file is like this(dpll part of it).

let dpll_SAT  = 
  try 
    let cnf = read_cnf Sys.argv.(1) in
    let state = create_state [] cnf in
    let (result, ass) = dpll state in
    match result with 
|false -> print_string "the cnf clauses are not satisfiable\n"
|_-> print_string "The cnf clauses are satisfiable and a model is as follows:\n"; 
    print_assignment ass;;
with
|x ->   
  print_endline ("Backtrace: "^(Printexc.get_backtrace ()));
  raise x)

I got the following error:

 Backtrace: (Program not linked with -g, cannot print stack backtrace)

 Fatal error: exception Not_found
(Program not linked with -g, cannot print stack backtrace)

So how do I link it then?

Thanks a lot

1

There are 1 answers

0
Thomash On

Maybe with the -g flag as suggested by the error message.

add the -g flag to this line: $(CC) -o dpll $(LIBES) dpll.cmo