Skip to content

Replacement for ocamlfind install? #5

Closed

Description

@bobot

The OCAML_NAMESPACES use case could remove the need for ocamlfind. But I don't see how the ocamlfind install feature is replaced. In particularly the possibility for distribution (debian, redhat) to tell where the library are and where to install them. For example the findlib package of debian use this configuration file /etc/ocamlfind.conf:

destdir="/usr/local/lib/ocaml/4.02.3"
path="/usr/local/lib/ocaml/4.02.3:/usr/lib/ocaml:/usr/lib/ocaml/METAS"

Perhaps in the namespace proposal ocamlc -config could indicate it, or opam-installer could become ocaml-installer with sane default.

PS: Sorry for spaming you with remarks and details. I just hope by doing so to harden this proposal.

Activity

  1. lpw25 commented on Jul 23, 2017

    @lpw25
    Owner

    I don't think an equivalent to ocamlfind install is necessary. Package systems are in charge of where things should be installed and are also in charge of running the build and install commands of packages. They should pass appropriate configure options to the packages so that they install in the desired locations. ocamlfind install just provides a side-channel for passing this information, but it isn't really needed and indeed it is ignored by a lot of the packages in the opam-repository.

  2. bobot commented on Jul 24, 2017

    @bobot
    Author

    People also used to install from source without opam, dpkg, or rpm. I think it should not be a possibility of the past. If after you installed ocaml from a debian package you want to install a library not packaged in debian, so from source, I think you should be able to install it without manual configuration.

    The configure && make && make install stanza works for many languages and tools, and worked in the ocaml world. I don't see why we should loose that when the solution is just to have place to specify destdir.

    Perhaps we don't need a replacement for ocamlfind install but we surely need one for ocamlfind printconf destdir.

  3. lpw25 commented on Jul 24, 2017

    @lpw25
    Owner

    The configure && make && make install stanza works for many languages and tools

    Does it though? It normally tries to install in the wrong place without using -prefix. Similarly, if I install something somewhere strange I expect to have to update PATH to make it available.

    We could add a default namespace of some sort (called something like ocaml, sys or default) which doesn't need to be in OCAML_NAMESPACES and is set to a site-packages directory underneath the OCAMLLIB directory. That might even avoid most people having to set the OCAML_NAMESPACES variable in the first place -- only needing it for more unusual situations.

  4. dbuenzli commented on Jul 24, 2017

    @dbuenzli

    FWIW I'm also not really convinced there's any loss here.

    Perhaps we don't need a replacement for ocamlfind install but we surely need one for ocamlfind printconf destdir.

    This could simply then simply be the parent of first element of OCAML_NAMESPACES no ?

  5. bobot commented on Jul 24, 2017

    @bobot
    Author

    Does it though? It normally tries to install in the wrong place without using -prefix.

    OCaml install itself in the right place /usr/local by default.

    That might even avoid most people having to set the OCAML_NAMESPACES variable in the first place -- only needing it for more unusual situations.

    Indeed having good default configuration help that.

    We could add a default namespace of some sort (called something like ocaml, sys or default)

    The destination directory needs to be specific because distribution packages are installed in /usr/lib/ocaml but administrators should manually install only in /usr/local/lib/ocaml/

    This could simply then simply be the parent of first element of OCAML_NAMESPACES no ?

    To me it seems quite fragile, people will play with it for other purposes.

    The minimum I'm proposing, is to add to ocaml -config, the default_install_libdir and to be complete default_install_prefix, so that we factorize the question of where to install things to OCaml. So by setting this two options in the ./configure of OCaml, Opam, redhat, debian would set a good default option for all the ./configure of any ocaml and libraries and tools.

  6. dbuenzli commented on Jul 24, 2017

    @dbuenzli

    The minimum I'm proposing, is to add to ocaml -config, the default_install_libdir and to be complete default_install_prefix, so that we factorize the question of where to install things to OCaml. So by setting this two options in the ./configure of OCaml, Opam, redhat, debian would set a good default option for all the ./configure of any ocaml and libraries and tools.

    I don't know how they manage these things (/cc @hendriktews @glondu) but if you do this please do not forget to add environment variables that allows to control this (e.g. see OCAMLLIB and for example the output of OCAMLLIB=/bla ocamlc -config).

    For opam and local switches we should rather set the trend towards a relocatable ocaml and somehow this goes against it.

  7. dbuenzli commented on Jul 24, 2017

    @dbuenzli

    Thinking a bit more about this, I'm really not sure that's doing this at the ocaml level is a good idea. A libdir and/or prefix is quite imprecise.

    Most OCaml packages are moving towards using opam .install files (e.g. those using topkg or jbuilder). It seems to me that these are much more flexible for system package managers: they allow upstream to describe what the package wishes to install in which "standard" unix directory (see the list here). This description can then be freely interpreted (e.g. using opam-installer) by the system package managers to know where they want to install this.

  8. bobot commented on Jul 25, 2017

    @bobot
    Author

    Most OCaml packages are moving towards using opam .install files

    .install files are indeed great but something needs to know where to install the files.

    This description can then be freely interpreted (e.g. using opam-installer) by the system package managers to know where they want to install this.

    From source the library needs to run something to install itself, it shouldn't be something different for each context. We could depend on opam but it is a very big code (a lot bigger than ocamlfind that people wants to replace), and opam-installer currently doesn't have good default. In my first comment I proposed ocaml-installer that would be like opam-installer just installed with the distribution.

    For opam and local switches we should rather set the trend towards a relocatable ocaml and somehow this goes against it.

    Is it not the contrary? Instead of people having to hardcode/guess paths, ocaml-installer could tell from the new location it is in or standardized environment variable where to put the files.

  9. dbuenzli commented on Jul 25, 2017

    @dbuenzli

    Is it not the contrary? Instead of people having to hardcode/guess paths, ocaml-installer could tell from the new location it is in or standardized environment variable where to put the files.

    Well if you don't have the environment variable you don't. If you do then you run in circles: the same as:

    .install files are indeed great but something needs to know where to install the files.

    applies. Who/what defines the variable.

    From source the library needs to run something to install itself, it shouldn't be something different for each context.

    Why should the library do this itself ? System package managers know better where to install things, and they can do so themselves using a tool that processes the .install files. There's no need for the package to do this itself.

    We could depend on opam but it is a very big code (a lot bigger than ocamlfind that people wants to replace), and opam-installer currently doesn't have good default.

    In v2 opam-installer only depends on opam-format which will soon only depend externally on ocamlgraph, re and cmdliner and I guess will a little bit of effort it should be possible to write something that depends only on the dependency-less opam-file-format library (/cc @AltGr).

    I think we are making the life of system packagers simpler if packages do not implement their own view of what an install should be based on a single, redefinable, value provided by the ocaml package.

  10. glondu commented on Jul 25, 2017

    @glondu

    I think we are making the life of system packagers simpler if [...]

    By default, Debian packaging tools essentially do ./configure -prefix /usr && make && make install DESTDIR=debian/some-directory. Our life of system packagers is simpler with packages that work this way. Anything else is adding burden to the packaging task.

    In particular, I don't know where the idea of using .install files (and not providing make install) helping us comes from. This is not true. Actually, it poses us problems at the moment, because of the dependency on opam for parsing them, and opam itself depending on packages that want to use this feature. Besides, the syntax of these .install files look new to me: why not a simpler or more standard format (such as JSON or XML)?

    All this reminds me of https://xkcd.com/927/

  11. bobot commented on Jul 25, 2017

    @bobot
    Author

    From source the library needs to run something to install itself, it shouldn't be something different for each context.

    Why should the library do this itself ? System package managers know better where to install things, and they can do so themselves using a tool that processes the .install files. There's no need for the package to do this itself.

    Are you always going through a package manager when installing library? I think people don't create a debian package each time they install something, that's why /usr/local is for. People doesn't always use opam pin for installing local source.

    I think we are making the life of system packagers simpler if packages do not implement their own view of what an install should be based on a single, redefinable, value provided by the ocaml package.

    You don't only need the destination when installing the library, tools also needs to know where they will be installed before their compilation in order to define the default location to look for their files. And moreover I'm not proposing for each package to implement their own view, I'm proposing that they all use the same tool that do the work.

  12. dbuenzli commented on Jul 25, 2017

    @dbuenzli

    By default, Debian packaging tools essentially do ./configure -prefix /usr && make && make install DESTDIR=debian/some-directory. Our life of system packagers is simpler with packages that work this way. Anything else is adding burden to the packaging task.
    [...]
    In particular, I don't know where the idea of using .install files (and not providing make install) helping us comes from. This is not true.

    I think you should take into account the following:

    1. We also need to make the life of people providing packages simpler. Having them to implement an install procedure in each of their package via a Makefile is not. So is for them to use Makefiles or autoconf.
    2. I don't see how providing you with a standard way of performing the installation of OCaml packages which is what .install file give is not helping you. It gives you a precise declarative manifest of what the package wants to install. It allows you not to have to understand what kind of things a package may be doing on a make install DESTDIR and provides you full control over the way you want to perform the install.
    3. Regarding the syntax of .install files I will not comment on this. I tried to suggest the opam devs to change this (Move OPAM's data formats to sexps ocaml/opam#2682) they choose not to. I respect their decision.

    Actually, it poses us problems at the moment, because of the dependency on opam for parsing them, and opam itself depending on packages that want to use this feature.

    This is being worked on see ocaml/opam#3009 and dbuenzli/cmdliner#86.

    All this reminds me of https://xkcd.com/927/

    It does not to me. Unless you see arbitrary computation (what happens on make install) as being a standard.

  13. dbuenzli commented on Jul 25, 2017

    @dbuenzli

    Are you always going through a package manager when installing library?

    Yes.

  14. dbuenzli commented on Jul 25, 2017

    @dbuenzli

    You don't only need the destination when installing the library, tools also needs to know where they will be installed before their compilation in order to define the default location to look for their files.

    Note that a large of amount of packages will not this (basically all of those who do not use etc files). When this is needed the build system should allow this to be specified before hand, and the system package manager will plug the right value, it will then be its duty to ensure it's using the same destination when it processes the .install file; that doesn't sound terribly difficult.

    And moreover I'm not proposing for each package to implement their own view, I'm proposing that they all use the same tool that do the work.

    Well I'm proposing they all use the same file.

  15. lpw25 commented on Jul 25, 2017

    @lpw25
    Owner

    I think having a tool for this is definitely over-kill. I think that packages should by default install themselves in somewhere like <prefix>/lib/ocaml/site-packages. The main question then is how these directories are expected to end up in the list of namespaces. I see roughly 3 approaches:

    1. Packaging systems/users are expected to include them in OCAML_NAMESPACES.
    2. Packaging systems/users are expected to pass them to OCaml's configuration
    3. OCaml includes these directories by default

    The cost of the first one is the need for the packaging system to set the value of OCAML_NAMESPACES. The benefit of it is that OCaml is not tied to its original install directory.

    The second one is easier for packing systems to deal with, but ties an OCaml installation to a particular fixed directory.

    The third one is even easier for packaging systems, but only if the defaults OCaml uses agree with where they think things should go. It ties all OCaml installations to a particular fixed directory (with maybe some configure-time selection to use different directories on say Windows).

    I think that having OCaml include <OCAMLLIB>/site-packages by default is easy and useful. That takes care of having /usr/lib/ocaml/site-packages as a namespace, and you need to adjust the OCAMLLIB environment variable anyway if you want to relocate OCaml.

    The more difficult case is including /usr/local/lib/ocaml/site-packages. Having such a directory is pretty Unix specific. Some options:

    • We could support a -default-namespace option on OCaml's configure to just add more namespaces to the default -- but then there isn't an easy way to override them if you want to relocate OCaml.

    • We could support a specific -local-prefix option on OCaml's configure along with an OCAML_LOCAL_LIB environment variable to override it. That's less general but makes relocation doable. I'm not sure what we would set this to in systems like windows which don't expect to have such a directory.

    • We could just expect the user to set OCAML_NAMESPACES in that case. Most people don't install packages by hand, and people should be pretty used to needing to extend environment variables to include the local version of a directory since quite a few systems adopt this approach.

    As a side-note can we keep the discussion to the things directly relevant to this proposal. I think the question of whether packaging systems should directly support .install files or expect packages to provide a make install command that uses opam-installer to do the work is basically orthogonal.

  16. lpw25 commented on Jul 25, 2017

    @lpw25
    Owner

    By the way python takes option 3 but then Debian has to patch python to add some additional directories to the path. So I'm not sure whether that is a point for or against 3.

  17. dbuenzli commented on Jul 25, 2017

    @dbuenzli

    I think having a tool for this is definitely over-kill. I think that packages should by default install themselves in somewhere like /lib/ocaml/site-packages.

    The problem is that a lot of packages do not really only install OCaml compilation objects, they also install manpages, documentation, support files, binaries, etc. which somehow your discussion completely overlooks. Once you take that into account and want to treat the installation of all the artefacts of a package in a unified manner having a tool is no longer necessarily over-kill.

    For this reason I think that the idea, suggested by this issue, that the proposal has to provide something to solve this problem is misguided. In other words what I'm saying here is that this point 1. of your three approaches seem the most sensitive to me.

    I think the question of whether packaging systems should directly support .install files or expect packages to provide a make install command that uses opam-installer to do the work is basically orthogonal.

    Note that this was not the question. The question was about using .install files at all.

  18. lpw25 commented on Jul 25, 2017

    @lpw25
    Owner

    they also install manpages, documentation, support files, binaries

    And by default I would expect them to be installed in the usual places for those things based on a given <prefix>. I would also expect all such things to be overrideable with ./configure options or a similar mechanism. My point is that I don't think that a site-packages directory is any different from these other cases.

    having a tool is no longer necessarily over-kill

    I was referring to the suggestion for a tool that told you where a particular install of OCaml wanted libraries installed. A tool that takes care of putting things in the right default places based on a prefix, as opam-installer does is clearly still useful.

    Anyway at this point I'm inclined to do the following:

    1. By default include <OCAMLLIB>/site-packages as a namespace called lib. Since this will default to <prefix>/lib/ocaml/site-packages that is the default directory which packages should install themselves, and the location that packaging systems should make packages install themselves.
    2. Don't do anything to explicitly support /usr/local/lib/ocaml/site-packages. People building packages themselves from source without opam can always update their OCAML_NAMESPACES variable by hand. This is a less important use case than it once was and expecting users to update environment variables when using /usr/local versions of things is fairly common. Besides it will be easier to add some support for this later than to remove it if it turns out to be ill-thought out or useless.

    @bobot Do you think that is sufficient to address your original issue?

  19. bobot commented on Jul 25, 2017

    @bobot
    Author

    @bobot Do you think that is sufficient to address your original issue?

    The lib namespace address the point to where to find the libraries. My original issue specifically talk about Debian and where to install libraries directly at the right place. So I think that part is addressed by refusing the debian case. It is your proposal so I'm happy if the choice is explicitly stated. I would prefer if all the known use case could be taken into account.

    People building packages themselves from source without opam can always update their OCAML_NAMESPACES variable by hand.

    So the user would have to replace the first namespace with name lib: by a new one, and rename the old? If two are named identically will that not be confusing.

    Besides it will be easier to add some support for this later than to remove it if it turns out to be ill-thought out or useless.

    It is also hard to split concepts that are initially merged, e.g. where to find libraries and where to install them.

    A tool that takes care of putting things in the right default places based on a prefix, as opam-installer does is clearly still useful.

    Since actually opam-installer use /usr/local/ as default prefix, I could hope it will work also for debian once the structure of ocaml directories are unified.

  20. lpw25 commented on Jul 25, 2017

    @lpw25
    Owner

    So I think that part is addressed by refusing the debian case

    I'm slightly confused by your calling this the debian case. Just to make sure we're on the same page: you're referring to a user installing a library by hand from source rather than a library being installed by debian itself?

    So the user would have to replace the first namespace with name lib: by a new one, and rename the old?

    I was more thinking that they would do add it as something like local because you still want the lib one in there for libraries installed by debian itself. (i.e. you want both /usr/lib/ocaml/site-packages and /usr/local/lib/ocaml/site-packages).

  21. bobot commented on Jul 25, 2017

    @bobot
    Author

    @lpw25 In fact I like the idea of your proposal, my previous message was too pessimistic, the problem is perhaps just that the ocaml packages have been put in too many places in the past $prefix/lib or $prefix/lib/ocaml. Could we just add an option -add-default-namespace to ocaml configure for the /usr/local/ case (with an environnement variable for changing default) and instead of looking at the lib namespace, always install ocaml package in $prefix/lib/ocaml/sites-packages?

    Just to reduce the possibilities in order to simplify?

    EDIT: I misread what @lpw25 was proposing.

  22. bobot commented on Jul 25, 2017

    @bobot
    Author

    So I think that part is addressed by refusing the debian case

    I'm slightly confused by your calling this the debian case. Just to make sure we're on the same page: you're referring to a user installing a library by hand from source rather than a library being installed by debian itself?

    yes

  23. glondu commented on Jul 25, 2017

    @glondu

    We also need to make the life of people providing packages simpler. Having them to implement an install procedure in each of their package via a Makefile is not. So is for them to use Makefiles or autoconf.

    Come on, writing a Makefile wrapper around whatever is your preferred way of building and installing is not that difficult. And most of the time, you don't need autoconf.

    I don't see how providing you with a standard way of performing the installation of OCaml packages which is what .install file give is not helping you. It gives you a precise declarative manifest of what the package wants to install. It allows you not to have to understand what kind of things a package may be doing on a make install DESTDIR and provides you full control over the way you want to perform the install.

    The standard has been to do make install for ages. If you have a better way to do things, wrapping it into a make install shouldn't be too difficult.

    Regarding the syntax of .install files I will not comment on this. I tried to suggest the opam devs to change this (ocaml/opam#2682) they choose not to. I respect their decision.

    That's unfortunate and I'm on your side on this.

    All this reminds me of https://xkcd.com/927/

    It does not to me. Unless you see arbitrary computation (what happens on make install) as being a standard.

    I do. Building a project is already an arbitrary computation. And being allowed to do arbitrary computation doesn't mean you have to.

  24. bobot commented on Jul 25, 2017

    @bobot
    Author

    So the user would have to replace the first namespace with name lib: by a new one, and rename the old?

    I was more thinking that they would do add it as something like local because you still want the lib one in there for libraries installed by debian itself. (i.e. you want both /usr/lib/ocaml/site-packages and /usr/local/lib/ocaml/site-packages).

    I see, thank you. I prefer if we could have a --add-default-namespace ocaml configure option, but we could live with a debian patch for that (like python).

  25. lpw25 commented on Jul 25, 2017

    @lpw25
    Owner

    and instead of looking at the lib namespace, always install ocaml package in $prefix/lib/ocaml/sites-packages

    I think this is what people should do whether or not we provide an -add-default-namespace option.

    Could we just add an option -add-default-namespace to ocaml configure for the /usr/local/ case ?

    Something like this was what I had in mind when I said that something could be added to improve that use case in the future. Basically I think this is possibly a good idea but I'm not 100% certain it is exactly right, so I would prefer to leave it out of the initial proposal and come back to it later.

  26. dbuenzli commented on Jul 25, 2017

    @dbuenzli

    Come on, writing a Makefile wrapper around whatever is your preferred way of building and installing is not that difficult.

    Difficulty is not the question but @lpw25 requested not to talk about this further so I'll simply link to this in which you may find some of the reasons, especially the last sentence of the third paragraph. We can discuss this further on another venue if you wish so.

  27. lpw25 commented on Aug 28, 2017

    @lpw25
    Owner

    I've added the default lib namespace to the second draft of the proposal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions