Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
ocamlbuild: -use-runtime flag not working?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-07-28 (07:20)
From: Hugo Ferreira <hmf@i...>
Subject: ocamlbuild: -use-runtime flag not working?

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 
-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 files.
The contents of these are:

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

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"-use-runtime"; A"/home/hugof/Desktop/cudd/cuddrun"]);

| _ -> ()

Unfortunately, using the above files with the following command:

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?

Hugo Ferreira.