caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Ocamlbuild directory inclusion problem
@ 2009-10-24 16:11 Dario Teixeira
  2009-10-25 13:09 ` [Caml-list] " Nicolas Pouillard
  0 siblings, 1 reply; 3+ messages in thread
From: Dario Teixeira @ 2009-10-24 16:11 UTC (permalink / raw)
  To: caml-list

Hi,

I've come across another issue with Ocamlbuild, and I'm not sure if this one
is a bug or a feature.  Consider the project tree below; note that everything
under lib/ is supposed to produce a foo.cma library, while cmd/ is a command
line application that uses foo.cma (and which can be safely ignored for now).

|-- _tags
|-- lib/
|   |-- _tags
|   |-- foo.mllib
|   |-- foo_core.mlpack
|   |-- foo_core/
|   |   |-- (...)
|   |
|   |-- foo_ext.mlpack
|   |-- foo_ext/
|       |-- (...)
|
|-- cmd/
    |-- (...)

The file lib/_tags just contains "<foo_core> or <foo_ext>: include".  If I issue
"ocamlbuild foo.cma" inside the lib/ directory, then foo.cma gets built as expected.
However, if I move to the parent directory and issue "ocamlbuild lib/foo.cma",
I get an error:

ocamlc -pack lib/foo_ext/beta.cmo lib/foo_ext/alpha.cmo -o lib/foo_ext.cmo
File "_none_", line 1, characters 0-1:
Error: The implementation (obtained by packing)
       does not match the interface lib/foo_ext.mli:
       Modules do not match:
         sig val num : int end
       is not included in
         Foo_core.Zero.S
       Unbound module type Foo_core.Zero.S
Command exited with code 2.


The problem is of course that "-I lib" should be added to the invocation of ocamlc.
For this purpose I've created a myocamlbuild.ml in the root directory, with the
following contents:

let () = dispatch begin function
        | After_rules ->
                Pathname.define_context "lib/foo_ext" ["lib"];
        | _ -> ()
end


However, this doesn't work as expected.  Perhaps I've misunderstood the purpose
of Pathname.define_context?  In any case, I would expect a simple example like
this one to work even without the need for a myocamlbuild.ml plugin.  So, what
is missing here?

Thanks in advance!
Best regards,
Dario Teixeira






^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Ocamlbuild directory inclusion problem
  2009-10-24 16:11 Ocamlbuild directory inclusion problem Dario Teixeira
@ 2009-10-25 13:09 ` Nicolas Pouillard
  0 siblings, 0 replies; 3+ messages in thread
From: Nicolas Pouillard @ 2009-10-25 13:09 UTC (permalink / raw)
  To: Dario Teixeira; +Cc: caml-list

Excerpts from Dario Teixeira's message of Sat Oct 24 18:11:26 +0200 2009:
> Hi,
> 
> I've come across another issue with Ocamlbuild, and I'm not sure if this one
> is a bug or a feature.  Consider the project tree below; note that everything
> under lib/ is supposed to produce a foo.cma library, while cmd/ is a command
> line application that uses foo.cma (and which can be safely ignored for now).
> 
> |-- _tags
> |-- lib/
> |   |-- _tags
> |   |-- foo.mllib
> |   |-- foo_core.mlpack
> |   |-- foo_core/
> |   |   |-- (...)
> |   |
> |   |-- foo_ext.mlpack
> |   |-- foo_ext/
> |       |-- (...)
> |
> |-- cmd/
>     |-- (...)
> 
> The file lib/_tags just contains "<foo_core> or <foo_ext>: include".  If I issue
> "ocamlbuild foo.cma" inside the lib/ directory, then foo.cma gets built as expected.
> However, if I move to the parent directory and issue "ocamlbuild lib/foo.cma",
> I get an error:
> 
> ocamlc -pack lib/foo_ext/beta.cmo lib/foo_ext/alpha.cmo -o lib/foo_ext.cmo
> File "_none_", line 1, characters 0-1:
> Error: The implementation (obtained by packing)
>        does not match the interface lib/foo_ext.mli:
>        Modules do not match:
>          sig val num : int end
>        is not included in
>          Foo_core.Zero.S
>        Unbound module type Foo_core.Zero.S
> Command exited with code 2.
> 
> 
> The problem is of course that "-I lib" should be added to the invocation of ocamlc.
> For this purpose I've created a myocamlbuild.ml in the root directory, with the
> following contents:

What about adding «"lib": tnclude» into the main _tags file?

BTW «<foo_core> or <foo_ext>: include» could be written
  «"foo_core" or "foo_ext": include»

Best regards,

-- 
Nicolas Pouillard
http://nicolaspouillard.fr


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Ocamlbuild directory inclusion problem
@ 2009-10-25 13:48 Dario Teixeira
  0 siblings, 0 replies; 3+ messages in thread
From: Dario Teixeira @ 2009-10-25 13:48 UTC (permalink / raw)
  To: Nicolas Pouillard; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 291 bytes --]

Hi,

> What about adding «"lib": tnclude» into the main _tags file?

It's already there, of course.  I'm attaching the whole thing,
since this is a tiny dummy example that reproduces the problem
in the real project.

Thanks for the reply!
Best regards,
Dario Teixeira



      

[-- Attachment #2: foo-src.tgz --]
[-- Type: application/binary, Size: 855 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-10-25 13:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-24 16:11 Ocamlbuild directory inclusion problem Dario Teixeira
2009-10-25 13:09 ` [Caml-list] " Nicolas Pouillard
2009-10-25 13:48 Dario Teixeira

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).