You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 5099 Reporter: gsutre Assigned to:@gasche Status: resolved (set by @damiendoligez on 2017-03-03T15:28:15Z) Resolution: suspended Priority: normal Severity: feature Version: 3.12.0+beta1 or 3.12.0+rc1 Category: -for ocamlbuild use https://github.com/ocaml/ocamlbuild/issues Tags: patch
Bug description
I obtain an error `Reference to undefined global ...' with ocamlbuild in
the following situation.
[File] [Contents]
example
|-- Main.ml let _ = Pack.Packed.g ()
|
|-- Pack.mlpack pack/Packed
|
|-- _tags : include
| <pack/*.cmx>: for-pack(Pack)
|
|-- lib
| |-- Lib.ml let f () = ()
| -- Lib.mli val f : unit -> unit -- pack
`-- Packed.ml let g () = Lib.f ()
/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 ocaml_compiler.ml 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 information
This byte-code linking problem with packs was reported to the list
two years ago, but with no answer:
Original bug ID: 5099
Reporter: gsutre
Assigned to: @gasche
Status: resolved (set by @damiendoligez on 2017-03-03T15:28:15Z)
Resolution: suspended
Priority: normal
Severity: feature
Version: 3.12.0+beta1 or 3.12.0+rc1
Category: -for ocamlbuild use https://github.com/ocaml/ocamlbuild/issues
Tags: patch
Bug description
I obtain an error `Reference to undefined global ...' with ocamlbuild in
the following situation.
[File] [Contents]
example
|-- Main.ml let _ = Pack.Packed.g ()
|
|-- Pack.mlpack pack/Packed
|
|-- _tags : include
| <pack/*.cmx>: for-pack(Pack)
|
|-- lib
| |-- Lib.ml let f () = ()
|
-- Lib.mli val f : unit -> unit
-- pack`-- Packed.ml let g () = Lib.f ()
$ ocamlbuild -classic-display Main.byte
/usr/pkg/bin/ocamldep.opt -modules Main.ml > Main.ml.depends
/usr/pkg/bin/ocamldep.opt -modules pack/Packed.ml > pack/Packed.ml.depends
/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/Packed.ml
/usr/pkg/bin/ocamlc.opt -pack pack/Packed.cmo -o Pack.cmo
/usr/pkg/bin/ocamlc.opt -c -I lib -o Main.cmo Main.ml
/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 ocaml_compiler.ml 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 information
This byte-code linking problem with packs was reported to the list
two years ago, but with no answer:
http://caml.inria.fr/pub/ml-archives/caml-list/2008/06/784c154d0f7b53995c0167ac63fc5bb9.en.html
I also recently sent a message (with attachments) to the Caml mailing list
regarding this issue:
http://groups.google.com/group/fa.caml/browse_thread/thread/73943caba65dbc3c
File attachments
The text was updated successfully, but these errors were encountered: