caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Recursive dependency issues
@ 2014-11-19 16:50 Kenneth Adam Miller
  2014-11-19 17:00 ` David Allsopp
  0 siblings, 1 reply; 6+ messages in thread
From: Kenneth Adam Miller @ 2014-11-19 16:50 UTC (permalink / raw)
  To: caml users

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

I have a library that I'm building against. I only consume an interface
from 2 specific directories; there are no other usages throughout my code.
I would like to be able to link against the library, and have the compiler
admit my code so long as it uses the interfaces of the other libraries
correctly. Instead, I'm having to recursively specify all the dependencies
of the library I consume!

I specify the location of my library with -ccopt -L location/to/it and then
afterward, have the cma or the cmxa before I specify my source that is
being compiled.

Should I statically link? What do I do to avoid the dependency hell?

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

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

* RE: [Caml-list] Recursive dependency issues
  2014-11-19 16:50 [Caml-list] Recursive dependency issues Kenneth Adam Miller
@ 2014-11-19 17:00 ` David Allsopp
  2014-11-19 17:15   ` Kenneth Adam Miller
  0 siblings, 1 reply; 6+ messages in thread
From: David Allsopp @ 2014-11-19 17:00 UTC (permalink / raw)
  To: caml users

Kenneth Adam Miller wrote:
> I have a library that I'm building against.

An OCaml library, or a C library? (it's unclear from what you say later)

> I only consume an interface from 
> 2 specific directories; there are no other usages throughout my code. I would
> like to be able to link against the library, and have the compiler admit my 
> code so long as it uses the interfaces of the other libraries correctly. 
> Instead, I'm having to recursively specify all the dependencies of the library 
> I consume! 
> 
> I specify the location of my library with -ccopt -L location/to/it and then 

-ccopt is used with C libraries - are you sure you're trying to do the correct thing?

> afterward, have the cma or the cmxa before I specify my source that is being compiled. 
> 
> Should I statically link? What do I do to avoid the dependency hell?

You are (probably) statically linking - it sounds like you're mixing terminology. If you use an OCaml library foo.cmxa which depends on bar.cmxa then you do have to specify bar.cmxa before linking foo.cmxa - that's not dependency hell, it's just linking! There is a simple solution to this: ocamlfind. It manages all of the linking instructions for you simply by specifying the package that you need to be available.


David

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

* Re: [Caml-list] Recursive dependency issues
  2014-11-19 17:00 ` David Allsopp
@ 2014-11-19 17:15   ` Kenneth Adam Miller
  2014-11-19 21:08     ` John Whitington
  0 siblings, 1 reply; 6+ messages in thread
From: Kenneth Adam Miller @ 2014-11-19 17:15 UTC (permalink / raw)
  To: caml users

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

Ok. Does anybody know how to use OCamlMakefile to have it do this? The
commands already call ocamlfind before ocamlc;

ocamlfind ocamlc ...

is there before every compile command. Does ocamlfind only look in ~/.opam?
All my dependencies are local...

On Wed, Nov 19, 2014 at 12:00 PM, David Allsopp <dra-news@metastack.com>
wrote:

> Kenneth Adam Miller wrote:
> > I have a library that I'm building against.
>
> An OCaml library, or a C library? (it's unclear from what you say later)
>
> > I only consume an interface from
> > 2 specific directories; there are no other usages throughout my code. I
> would
> > like to be able to link against the library, and have the compiler admit
> my
> > code so long as it uses the interfaces of the other libraries correctly.
> > Instead, I'm having to recursively specify all the dependencies of the
> library
> > I consume!
> >
> > I specify the location of my library with -ccopt -L location/to/it and
> then
>
> -ccopt is used with C libraries - are you sure you're trying to do the
> correct thing?
>
> > afterward, have the cma or the cmxa before I specify my source that is
> being compiled.
> >
> > Should I statically link? What do I do to avoid the dependency hell?
>
> You are (probably) statically linking - it sounds like you're mixing
> terminology. If you use an OCaml library foo.cmxa which depends on bar.cmxa
> then you do have to specify bar.cmxa before linking foo.cmxa - that's not
> dependency hell, it's just linking! There is a simple solution to this:
> ocamlfind. It manages all of the linking instructions for you simply by
> specifying the package that you need to be available.
>
>
> David
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs

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

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

* Re: [Caml-list] Recursive dependency issues
  2014-11-19 17:15   ` Kenneth Adam Miller
@ 2014-11-19 21:08     ` John Whitington
  2014-11-19 21:20       ` Kenneth Adam Miller
  0 siblings, 1 reply; 6+ messages in thread
From: John Whitington @ 2014-11-19 21:08 UTC (permalink / raw)
  To: Kenneth Adam Miller; +Cc: caml users

Hi,

Kenneth Adam Miller wrote:
> Ok. Does anybody know how to use OCamlMakefile to have it do this? The
> commands already call ocamlfind before ocamlc;
>
> ocamlfind ocamlc ...

To use OCaml packages with OCamlMakefile, you want...

PACKS = mylib anotherlib yetanotherlib

Here's an example OCamlMakefile-based makefile:

https://github.com/johnwhitington/cpdf-source/blob/master/Makefile

See the OCamlMakefile documentation for the rest of the options.

Thanks,

-- 
John Whitington
Director, Coherent Graphics Ltd
http://www.coherentpdf.com/


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

* Re: [Caml-list] Recursive dependency issues
  2014-11-19 21:08     ` John Whitington
@ 2014-11-19 21:20       ` Kenneth Adam Miller
  2014-12-02 21:02         ` Gerd Stolpmann
  0 siblings, 1 reply; 6+ messages in thread
From: Kenneth Adam Miller @ 2014-11-19 21:20 UTC (permalink / raw)
  To: caml users

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

I use packs, but so far I was pretty certain that this used the compiler to
find the location in .opam; some of the packages that I use with PACKS are
not dependencies of the local library and are installed through opam. PACKS
finds them, and to be clear, I do in fact have multiple installations of
some libraries, and at different versions between the local development and
opam.

On Wed, Nov 19, 2014 at 4:08 PM, John Whitington <
john@coherentgraphics.co.uk> wrote:

> Hi,
>
> Kenneth Adam Miller wrote:
>
>> Ok. Does anybody know how to use OCamlMakefile to have it do this? The
>> commands already call ocamlfind before ocamlc;
>>
>> ocamlfind ocamlc ...
>>
>
> To use OCaml packages with OCamlMakefile, you want...
>
> PACKS = mylib anotherlib yetanotherlib
>
> Here's an example OCamlMakefile-based makefile:
>
> https://github.com/johnwhitington/cpdf-source/blob/master/Makefile
>
> See the OCamlMakefile documentation for the rest of the options.
>
> Thanks,
>
> --
> John Whitington
> Director, Coherent Graphics Ltd
> http://www.coherentpdf.com/
>
>

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

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

* Re: [Caml-list] Recursive dependency issues
  2014-11-19 21:20       ` Kenneth Adam Miller
@ 2014-12-02 21:02         ` Gerd Stolpmann
  0 siblings, 0 replies; 6+ messages in thread
From: Gerd Stolpmann @ 2014-12-02 21:02 UTC (permalink / raw)
  To: Kenneth Adam Miller; +Cc: caml users

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

ocamlfind also looks into the directories in the environment variable
OCAMLPATH for packages.

Gerd

Am Mittwoch, den 19.11.2014, 16:20 -0500 schrieb Kenneth Adam Miller:
> I use packs, but so far I was pretty certain that this used the
> compiler to find the location in .opam; some of the packages that I
> use with PACKS are not dependencies of the local library and are
> installed through opam. PACKS finds them, and to be clear, I do in
> fact have multiple installations of some libraries, and at different
> versions between the local development and opam.
> 
> On Wed, Nov 19, 2014 at 4:08 PM, John Whitington
> <john@coherentgraphics.co.uk> wrote:
>         Hi,
>         
>         Kenneth Adam Miller wrote:
>                 Ok. Does anybody know how to use OCamlMakefile to have
>                 it do this? The
>                 commands already call ocamlfind before ocamlc;
>                 
>                 ocamlfind ocamlc ...
>         
>         To use OCaml packages with OCamlMakefile, you want...
>         
>         PACKS = mylib anotherlib yetanotherlib
>         
>         Here's an example OCamlMakefile-based makefile:
>         
>         https://github.com/johnwhitington/cpdf-source/blob/master/Makefile
>         
>         See the OCamlMakefile documentation for the rest of the
>         options.
>         
>         Thanks,
>         
> 
> 
-- 
------------------------------------------------------------
Gerd Stolpmann, Darmstadt, Germany    gerd@gerd-stolpmann.de
My OCaml site:          http://www.camlcity.org
Contact details:        http://www.camlcity.org/contact.html
Company homepage:       http://www.gerd-stolpmann.de
------------------------------------------------------------

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

end of thread, other threads:[~2014-12-02 21:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-19 16:50 [Caml-list] Recursive dependency issues Kenneth Adam Miller
2014-11-19 17:00 ` David Allsopp
2014-11-19 17:15   ` Kenneth Adam Miller
2014-11-19 21:08     ` John Whitington
2014-11-19 21:20       ` Kenneth Adam Miller
2014-12-02 21:02         ` Gerd Stolpmann

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