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
error building native code with ocamlbuild
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Ashish Agarwal <agarwal1975@g...>
Subject: error building native code with ocamlbuild
Using ocamlbuild on the following example to build native code includes a
library twice, causing an error, but byte-code works fine. Am I doing
something wrong or is it a bug? Thanks for any help.

~/tmp$ cat
open Ocamlbuild_plugin;;
open Command;;

dispatch begin function
  | After_rules ->
      ocaml_lib ~extern:true "unix";
  | _ -> ()

~/tmp$ cat _tags
<pwd.{native,byte}>: use_unix

~/tmp$ cat
let _ = print_endline (Unix.getcwd())

~/tmp$ ocamlbuild pwd.byte
Finished, 3 targets (3 cached) in 00:00:00.

~/tmp$ ocamlbuild pwd.native
+ /usr/local/bin/ocamlopt.opt unix.cmxa unix.cmxa pwd.cmx -o pwd.native
Files /usr/local/lib/ocaml/unix.cmxa and /usr/local/lib/ocaml/unix.cmxa
both define a module named Unix
Command exited with code 2.
Compilation unsuccessful after building 4 targets (2 cached) in 00:00:00.