Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005099OCamlOCamlbuild (the tool)public2010-07-08 23:192013-09-05 23:29
Assigned Togasche 
PlatformOSOS Version
Product Version3.12.0+beta1 or 3.12.0+rc1 
Target VersionFixed in Version 
Summary0005099: Dependencies at byte-code link with mlpack
DescriptionI obtain an error `Reference to undefined global ...' with ocamlbuild in
the following situation.

[File] [Contents]

|-- let _ = Pack.Packed.g ()
|-- Pack.mlpack pack/Packed
|-- _tags <lib>: include
| <pack/*.cmx>: for-pack(Pack)
|-- lib
| |-- let f () = ()
| `-- Lib.mli val f : unit -> unit
`-- pack
      `-- let g () = Lib.f ()

$ ocamlbuild -classic-display Main.byte
/usr/pkg/bin/ocamldep.opt -modules >
/usr/pkg/bin/ocamldep.opt -modules pack/ > pack/
/usr/pkg/bin/ocamldep.opt -modules lib/Lib.mli > lib/Lib.mli.depends
/usr/pkg/bin/ocamlc.opt -c -I lib -o lib/Lib.cmi lib/Lib.mli
/usr/pkg/bin/ocamlc.opt -c -I pack -I lib -o pack/Packed.cmo pack/
/usr/pkg/bin/ocamlc.opt -pack pack/Packed.cmo -o Pack.cmo
/usr/pkg/bin/ocamlc.opt -c -I lib -o Main.cmo
/usr/pkg/bin/ocamlc.opt Pack.cmo Main.cmo -o Main.byte
+ /usr/pkg/bin/ocamlc.opt Pack.cmo Main.cmo -o Main.byte
File "_none_", line 1, characters 0-1:
Error: Error while linking Pack.cmo:
Reference to undefined global `Lib'
Command exited with code 2.

If I read the code correctly, this comes from the function prepare_link
in which derives the dependencies from the files
.ml.depends and .mli.depends. But these files are not generated for
packs, hence the required dependencies are not build.

The attached small patch (patch-ocamlbuild-link-pack-deps.diff) simply
treats the .mlpack files as dependency files for packs, which fixes
the issue.
Additional InformationThis byte-code linking problem with packs was reported to the list
two years ago, but with no answer: [^]

I also recently sent a message (with attachments) to the Caml mailing list
regarding this issue: [^]
Attached Filesdiff file icon patch-ocamlbuild-link-pack-deps.diff [^] (805 bytes) 2010-07-08 23:19 [Show Content]
diff file icon example.diff [^] (1,252 bytes) 2010-07-08 23:21 [Show Content]

- Relationships

-  Notes
There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
2010-07-08 23:19 gsutre New Issue
2010-07-08 23:19 gsutre File Added: patch-ocamlbuild-link-pack-deps.diff
2010-07-08 23:21 gsutre File Added: example.diff
2010-07-22 11:39 ertai Status new => assigned
2010-07-22 11:39 ertai Assigned To => xclerc
2012-02-02 15:17 protz Category OCamlbuild => OCamlbuild (the tool)
2013-07-28 22:22 gasche Assigned To xclerc => gasche
2013-09-05 23:29 doligez Tag Attached: patch

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker