#9 Easier library integration

Johan Mazel

I may be wrong regarding the standard use of ODT. If it is the case, please ignore my request.
Right now, if I want to add a library, I need to manually specify a path (where the mli file is located) and the implementation file (*.cmx).
Would it be possible to use something similar as ocamlbuild where the user only give the library name ?
It would greatly ease the use of tool such as OPAM. Because right I need to change all my paths is want to change compiler version in OPAM.


  • Emmanuel Dieul

    Emmanuel Dieul - 2013-07-09


    First, for ODT, libraries present into the builder profile are only cma/cmo/cmxa/cmx files. Their folder is automatically added by ODT. I don't think - tell me if I'm wrong - this is necessary to add the folder of the .mli file.

    If you need to switch to another release of ocaml, it should be really simple in ODT. As you might already know, standard libraries can be referenced as "+" in front of their filename (e.g. +list.cmx).
    If you specify standard paths like this, changing you PATH environment variable or setting the ocaml location into the global ODT preferences should be enough.

    Now, if you have to change something else than standard libraries, there is really nothing else than doing it manually, one by one, in ODT. However, there is a trick: manually editing the ".preferences.xml" file of your project. To do so, you have to close your project into Eclipse, then manually editing this file by replacing the path of your libraries. Then, after saving, you can re-open your project into Eclipse.

    Please, tell me in which case your feature request can be placed, and if it can concern more than libraries.

  • Johan Mazel

    Johan Mazel - 2013-07-11

    Actually, I am talking about libraries like Core or Batteries. I guess that these are indeed outside of standard library.
    If I understand correctly, I need to manually add each library (either through the GUI or the .preferences.xml)? This can be pretty complicated with OPAM and several OCaml versions.
    Would it be possible to automatize this process (I think that for example ocamlbuild uses ocamlfind to this end) ?

    Last edit: Johan Mazel 2013-07-11
  • Emmanuel Dieul

    Emmanuel Dieul - 2013-07-15

    Well, I think these libraries are installed into the OCaml standard library folder (e.g. /usr/lib/ocaml/...). Otherwise, how could they be found automatically?

    Moreover, I don't think you can switch between several OCaml distributions so easily: at least, you need to specify with which ocaml distribution you want to work with. If you install several releases, this mean, for example, you installed them into /usr/local/ocaml/x.y folders. The several ocamlc binaries cannot be used as you want without specifying which release you want to use. Or I am wrong?

    For compiling only, you only need to specify the folder where to find the libraries into you ODT project. If this folder is a standard library folder, it begins with a "+" (e.g. +threads). It is not depending of the the ocaml release you use. In conjunction with the specification of the ocaml distribution location (into the ODT workspace preferences), you can "switch" between several releases.

    Finally, If you often have to deal with several releases of your project and several OCaml releases, isn't it a good idea to deal with several workspaces, each one with a fixed configuration?

    I'm always pro to make things easier, but I really need to understand what is complicated first. If something
    is wrong in what I said above, could you please illustrate, with a concrete working example:
    1. what you have now,
    2. what you need to do to switch between your several releases,
    3. eventually, what could be easier.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks