caml-list - the Caml user's mailing list
 help / Atom feed
* [Caml-list] ocamldep and stdlib
@ 2021-12-10 21:37 David E. Narvaez
  2021-12-10 22:12 ` Sébastien Hinderer
  2021-12-11 11:44 ` Nicolás Ojeda Bär
  0 siblings, 2 replies; 3+ messages in thread
From: David E. Narvaez @ 2021-12-10 21:37 UTC (permalink / raw)
  To: caml-list

Greetings,

I am fairly inexperienced with OCaml but I have inherited a Makefile from a 
project, and it uses ocamldep in a way that is equivalent to the following 
example:

$ cat hello.ml
module StringSet = Set.Make(String) ;;
module StringMap = Map.Make(String) ;;
$ ocamldep -I /usr/lib64/ocaml/ hello.ml
hello.cmo : \
    /usr/lib64/ocaml/string.cmi \
    /usr/lib64/ocaml/set.cmi \
    /usr/lib64/ocaml/map.cmi
hello.cmx : \
    /usr/lib64/ocaml/string.cmx \
    /usr/lib64/ocaml/set.cmx \
    /usr/lib64/ocaml/map.cmx

The problem is those dependency files do not exist, instead I have these 
files:

$ ls -1 /usr/lib64/ocaml/*{string,set,map}.cm[ix]
/usr/lib64/ocaml/stdlib__map.cmi
/usr/lib64/ocaml/stdlib__map.cmx
/usr/lib64/ocaml/stdlib__set.cmi
/usr/lib64/ocaml/stdlib__set.cmx
/usr/lib64/ocaml/stdlib__string.cmi
/usr/lib64/ocaml/stdlib__string.cmx

I have noticed that I do not get incorrect filenames (in fact, any filenames) 
if I do not specify the location of the ocaml libraries:

$ ocamldep hello.ml
hello.cmo :
hello.cmx :

but I was hoping I did not have to change the call in the Makefile.

I have tested this in OCaml 4.09.0 and 4.12.1. Is this a bug? or what is the 
correct way of using ocmaldep in this case?

Thanks in advance for your help.

-- 
David E. Narvaez



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

* Re: [Caml-list] ocamldep and stdlib
  2021-12-10 21:37 [Caml-list] ocamldep and stdlib David E. Narvaez
@ 2021-12-10 22:12 ` Sébastien Hinderer
  2021-12-11 11:44 ` Nicolás Ojeda Bär
  1 sibling, 0 replies; 3+ messages in thread
From: Sébastien Hinderer @ 2021-12-10 22:12 UTC (permalink / raw)
  To: caml-list

Hello David,

I think you are right that the good thing to do is to remove the "-I"
option and its argument. It does not make sense to me to keep it and I
don't understand why it's there.

Best wishes,

Sébastien.

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

* RE: [Caml-list] ocamldep and stdlib
  2021-12-10 21:37 [Caml-list] ocamldep and stdlib David E. Narvaez
  2021-12-10 22:12 ` Sébastien Hinderer
@ 2021-12-11 11:44 ` Nicolás Ojeda Bär
  1 sibling, 0 replies; 3+ messages in thread
From: Nicolás Ojeda Bär @ 2021-12-11 11:44 UTC (permalink / raw)
  To: caml-list, David E. Narvaez

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

Dear David,

In general these kinds of questions are better asked in https://discuss.ocaml.org/. You you will get more and faster answers there.

Regarding your question, removing the `-I` flag will probably fix your problem. Very briefly, the standard library is now "wrapped", which means using prefixed filenames for the compilation artifacts in order to implement a form of namespacing. The problem is that `ocamldep` does not have good support for these kinds of libraries. In any case, declaring explicit dependencies to the standard library is not normally necessary as it only changes when OCaml itself is updated.

If you have further questions, I encourage you to ask them at Discuss, as mentioned above.

Cheers,
Nicolas

________________________________
De : caml-list-request@inria.fr <caml-list-request@inria.fr> de la part de David E. Narvaez <den9562@rit.edu>
Envoyé : vendredi 10 décembre 2021 22:37
À : caml-list@inria.fr <caml-list@inria.fr>
Objet : [Caml-list] ocamldep and stdlib

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.


Greetings,

I am fairly inexperienced with OCaml but I have inherited a Makefile from a
project, and it uses ocamldep in a way that is equivalent to the following
example:

$ cat hello.ml
module StringSet = Set.Make(String) ;;
module StringMap = Map.Make(String) ;;
$ ocamldep -I /usr/lib64/ocaml/ hello.ml
hello.cmo : \
    /usr/lib64/ocaml/string.cmi \
    /usr/lib64/ocaml/set.cmi \
    /usr/lib64/ocaml/map.cmi
hello.cmx : \
    /usr/lib64/ocaml/string.cmx \
    /usr/lib64/ocaml/set.cmx \
    /usr/lib64/ocaml/map.cmx

The problem is those dependency files do not exist, instead I have these
files:

$ ls -1 /usr/lib64/ocaml/*{string,set,map}.cm[ix]
/usr/lib64/ocaml/stdlib__map.cmi
/usr/lib64/ocaml/stdlib__map.cmx
/usr/lib64/ocaml/stdlib__set.cmi
/usr/lib64/ocaml/stdlib__set.cmx
/usr/lib64/ocaml/stdlib__string.cmi
/usr/lib64/ocaml/stdlib__string.cmx

I have noticed that I do not get incorrect filenames (in fact, any filenames)
if I do not specify the location of the ocaml libraries:

$ ocamldep hello.ml
hello.cmo :
hello.cmx :

but I was hoping I did not have to change the call in the Makefile.

I have tested this in OCaml 4.09.0 and 4.12.1. Is this a bug? or what is the
correct way of using ocmaldep in this case?

Thanks in advance for your help.

--
David E. Narvaez



[-- Attachment #2: Type: text/html, Size: 5217 bytes --]

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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-10 21:37 [Caml-list] ocamldep and stdlib David E. Narvaez
2021-12-10 22:12 ` Sébastien Hinderer
2021-12-11 11:44 ` Nicolás Ojeda Bär

caml-list - the Caml user's mailing list

Archives are clonable: git clone --mirror https://inbox.ocaml.org/caml-list

AGPL code for this site: git clone https://public-inbox.org/ public-inbox