caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* ocamlbuild: -use-runtime flag not working?
@ 2008-07-28  7:20 Hugo Ferreira
  0 siblings, 0 replies; only message in thread
From: Hugo Ferreira @ 2008-07-28  7:20 UTC (permalink / raw)
  To: caml-list

Hello,

I am attempting to use the MLCuDD library that gives me access to
the CuDD C library. I order to use this library I did various
successful experiments using the ocamlbuid command-line.
Two examples are:

  # Bytecode, one option
ocamlbuild -no-hygiene -Is $PROJ_PATH -lib cudd -cflags 
-I,/home/hugof/Desktop/cudd/ -lflags 
-I,/home/hugof/Desktop/cudd/,-use-runtime,/home/hugof/Desktop/cudd/cuddrun 
-verbose 100 src/parser.byte

Bytecode, second option
#ocamlbuild -no-hygiene -Is $PROJ_PATH -lib cudd -cflags 
-I,/home/hugof/Desktop/cudd/ -lflags 
-I,/home/hugof/Desktop/cudd/,-custom -verbose 100 src/parser.byte

I assume that the use of "-custom" and "-use-runtime" are equivalent.
I then proceeded to use the _tags and myocamlbuild.ml files.
The contents of these are:

cat _tags
true: use_menhir, debug, profile
<cudd/**>: not_hygienic
"src/parser.d.byte": use_unix, use_cudd

cat myocamlbuild.ml
open Ocamlbuild_plugin;;
open Command;;

dispatch begin function
| After_rules ->
     (* add CuDD library as external library *)
     ocaml_lib ~extern:true ~dir:"/home/hugof/Desktop/cudd" "cudd";

     (* CuDD is a C library. So handle native code linking correctly *)
     flag ["link"; "ocaml"; "byte" ; "use_cudd"]
     (*(S[A"-custom"]);*)
     (S[A"-use-runtime"; A"/home/hugof/Desktop/cudd/cuddrun"]);

| _ -> ()
end;;

Unfortunately, using the above files with the following command:

PROJ_PATH="cudd,src"
ocamlbuild -Is $PROJ_PATH -verbose 100 all.otarget

fails with:

+ /home/hugof/ocaml/godi/bin/ocamlc.opt unix.cma -g -I 
/home/hugof/Desktop/cudd cudd.cma -use-runtime 
/home/hugof/Desktop/cudd/cuddrun src/parser.d.cmo -o src/parser.d.byte
Error while linking /home/hugof/ocaml/godi/lib/ocaml/std-lib/unix.cma(Unix):
The external function `unix_dup' is not available
Command exited with code 2.

However if I use (S[A"-custom"]); compilation succeeds.
Am I doing anything wrong?

TIA,
Hugo Ferreira.



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-07-28  7:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-28  7:20 ocamlbuild: -use-runtime flag not working? Hugo Ferreira

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).