Conversation
|
Also cc @rgrinberg for the Dune part. |
|
Naive question again, sorry: why are we using |
compilerlibs/META
Outdated
|
|
||
| package "common" ( | ||
| requires = "compiler-libs" | ||
| version = "[distributed with Ocaml]" |
There was a problem hiding this comment.
Is this finally the opportunity to correct the spelling to OCaml ? Or alternatively, it might make sense to just version it with the compiler revision itself.
There was a problem hiding this comment.
Actually you are right, it may be a good idea to include the compiler version here, but that will need a bit more work, so I wait to gather a bit more feedback before doing that.
There was a problem hiding this comment.
If including the version is a lot of build system hassle, then leaving it as the current string is just fine I think. No tool I'm aware of uses the findlib package version for any structured comparisons.
There was a problem hiding this comment.
Please make this change before 5.0 is released.
Please include the actual version number.
Please see let ocaml_version = "@VERSION@" in your local ocaml source tree.
Thank you so much for merging this PR.
There was a problem hiding this comment.
PR doing that should be following in the next couple of days, @olafhering and should be in 5.0.0~alpha1, yes.
Yes, sorry I should have been more explicit. This is a Findlib convention: the package name for a META file is taken to be the extension (if it exists) or, if there is no extension, it is the name of the parent directory. |
not quite true. There are only two possible location and name for META files currently supported by ocamlfind:
any other combinations are ignored. The value of
|
There was a problem hiding this comment.
I wholeheartedly welcome META files that would be shipped by the compiler. That would be awesome.
I have a comment about the current implementation though:
I’m not sure why we need to add +/stdlib to searchpath. Why not simply do exactly as ocamlfind already does and add the ${SITELIB} distinction directly in the compiler?
This way no modification of dune, ocamlfind would be necessary. ocamlfind already keeps META files and the if they already exist.findlib.conf
We would simply have to add an argument to the configure script and install and no further change would be required in the ecosystem.findlib.conf
There is also
Are you suggesting to install the compiler libraries directly inside |
mh no no, this wouldn’t require any change in the installation layout. The only thing that we would need to be installed compared to
exactly as |
OK, I understand your suggestion now. We still need to do something for non-ocamlfind users, right? Installing in the compiler directory seems to be the most natural alternative in this case... |
I don’t understand. In my scenario nothing else changes so why do we need to do something else? |
Because META files are consumed by Dune (even if you don't use |
mmh, sorry I don’t understand either. In any case, dune already has builtin dummy definitions for the compiler packages (which are taken over the META files since ocaml/dune#4946) so it doesn’t matter for dune anyway. Again, with my proposal, this would be exactly equivalent to what ocamlfind already does. Dune and all the other ecosystem parts work pretty well as-is. |
Well, one of the objectives of the present PR is for Dune not to have to keep its own set of built-in META files which causes issues now and then. It doesn't feel right to make something that will only benefit |
again, AFAIK dune already handles META files correctly, and even if it is missing something this would only be required to be fixed whenever you wish to remove those dummy builtins, which already requires patching. So this doesn’t change anything. I’m not seeing why this would only benefit ocamlfind users. This benefits everyone using the tried and tested (19 years) solution. |
I feel we are talking past each other. I agree with your suggestion to install META files directly into |
Same as for "ocamlfind/opam users":
Overall, it simply moves things currently done in ocamlfind to the compiler. For example:
Thinking about it more, I don’t think we even need the |
Sorry, I still don't understand what is the use of doing this for people that do not use
As mentioned, something along these lines in the case of an |
|
For the benefit of readers struggling to follow the back-and-forth (like myself :)), I try to summarize the state of the discussion so far. The question is: where should the META files for the compiler libraries be installed? @kit-ty-kate proposes the addition of a new configure-time flag
This flag would be used by There is also the question of what to do when
There is another possibility which is to install the
In both cases, Dune will need to be patched to look inside |
Why isn't |
Sounds fine, but the question is what that default should be. In the case of a non
This is another aspect of the issue. Dune does not have a notion of "site lib" and does not read |
|
I'm sorry but I have difficulty in following the discussion here. I don't understand:
I think the Given how packages get their name in ocamlfind, they will also need to be of the from I'm not sure I see the issues arising from such a simple implementation. All of this of course unless upstream eventually wants to bite the bullet to properly isolate its libraries in directories and possibly namespace them under the |
If I understood correctly, @kit-ty-kate's point was that if we just install them in This sounds somewhat reasonable to me, but of course for cases when there is no pre-existing "site lib" I suggest to do as you suggest, namely to install them in
Agreed, I don't think we should do this. |
This is what @nojb is proposing in this PR I believe. However the issue I was pointing out is that ocamlfind does not work this way and would have to be changed (same for dune and virtually any other build systems relying on META files). My proposal is to instead import what ocamlfind is currently doing. This way there are no unforceen breakage and annoying patches to make (only dune has to be patched, but will happen regardless of the solution chosen, so it doesn’t matter) |
Sorry to add more to the confusion. Indeed I was mislead by the documentation
Which unfortunately (I tested) doesn't seem to be true. I'm sure this is not going to be popular, I'll just mention it. Why not take the opportunity to introduce the |
In theory i like the idea, however in practice sadly the same problem arises because |
Right but IIUC this is a matter for system packagers to do a |
|
It feels as if the discussion is diverging. So far I see the following three options:
Opinions? Personally I am starting to feel that perhaps 3) is the best right now :) |
I thought it was actually converging :–)
Well if you are going to do something, do something that works according the way things works for the existing tools. I mean 1) only makes sense if you consider's I initially was not so hot on introducing the |
|
The more I think about this PR, the more I would like it to bite that bullet, so that I have written a fair amount of eco-system tool and build systems and I think there's not a single instance in which I didn't have to make special cases and introduce hacks for Also it actually makes your task and maintenance simpler: a single |
|
I have rebased the PR;and updated the META file to use the new installation directory for libraries. The installation path for META files is now configured by a new Patching dune(ocaml/dune#5824) and ocamlfind(ocaml/ocamlfind#45) to use those new META files seems quite straightforward. |
stdlib/META.bytes
Outdated
| @@ -0,0 +1,3 @@ | |||
| name="bytes" | |||
| version="[distributed with OCaml]" | |||
| description="dummy backward-compatibility package for mutable strings" | |||
There was a problem hiding this comment.
If I understand correctly, this dummy file makes it possible to depend on the bytes library (say from inside a Dune file) without having to install anything else apart from the compiler. There are other such compatibility shims which play the same role for other parts of the standard library:
META.seq: https://github.com/ocaml/opam-repository/blob/master/packages/seq/seq.base/opamMETA.bigarray: https://github.com/ocaml/opam-repository/blob/master/packages/base-bigarray/base-bigarray.base/opam
Could we consider shipping them as part of the compiler as well? While this may not change much for opam users, it does for non-opam users (eg Windows) where the current situation means you are forced to "install" these compatibility packages (which are empty) just to get the library names into the environment.
There was a problem hiding this comment.
Distributing those packages sounds like a good idea, I kind of remember that the META.bigarray might require a more subtle handling, but I will have a look.
There was a problem hiding this comment.
@dra27 correctly clarified that indeed we don't want to ship META.bigarray at all because there won't be a bigarray package anymore in the future.
There was a problem hiding this comment.
There's a much longer answer available on this, but TL;DR I (quite strongly) think we should not ship META.bytes (or any other back-porting META files). Cross-referencing ocaml/opam-repository#21333 (comment), for Dune in particular, this can be resolved in a similar way to bigarray - although it can be resolved much more simply because no project using Jbuilder or Dune should ever have referred to the findlib bytes package!
For Jbuilder/Dune packages, if a package (incorrectly) refers to the bytes package in a libraries field, then its opam file should also refer to base-bytes, which will pull in ocamlfind. ocamlfind will then be responsible for the bytes package (it's a backport package which just happens to live in findlib) and Dune will then be fine. We're doing vast amounts of metadata adjustment in opam-repository with the normal readiness testing for 5.0, so adjusting these will not be a problem. The important point with base-bytes is that we don't force releases of these packages - there's an incentive to release corrected versions without a dependency on base-bytes because it lifts the findlib dependency, but there's not a requirement to release, because we just amend the dependencies in opam-repository.
There was a problem hiding this comment.
I (quite strongly) don't think we should not ship META.bytes
Do you mean that we should ship META.bytes, or that we should not ship it?
There was a problem hiding this comment.
Ugh - I was quite strongly seeing double as usual! I think we should not ship it - sorry for muddying that in the comment (I've edited it!)
|
Nitpick: there is a spurious _ in the commit message `Install META files
inside $(SITELIB_DIR)/$(libname) except for META.byte`.
|
|
There's a couple of details I'm still checking, but the only major suggestion I have is for findlib itself - it will be easy to have findlib's |
|
Following both a closer look at this, and an offline discussion with @Octachron and @shindere, we propose reverting to something much closer to @nojb's original suggestion. Concretely, this means reverting the addition of The rationale for this is catering for opam's In other words, supporting both of these existing use-cases (which are, incidentally, really used "in the wild") leads us to an ownership problem with the |
nojb
left a comment
There was a problem hiding this comment.
I didn't look at every detail, but globally LGTM, modulo a question. (Note that I cannot formally approve my own PR.)
| @@ -0,0 +1,43 @@ | |||
| version = "[distributed with OCaml]" | |||
There was a problem hiding this comment.
I am not proposing to do it in this PR, but it would be nice to have the actual OCaml version here.
There was a problem hiding this comment.
@shindere has a follow-up commit to do this (for 5.0)
| version = "[internal]" | ||
| ) | ||
|
|
||
| package "none" ( |
There was a problem hiding this comment.
How is this package used?
There was a problem hiding this comment.
I have some follow-up commits on top of @shindere's to tidy things like this up - it seems good that this PR moves ocamlfind's META files into the compiler and then we alter them in subsequent PRs (if necessary)
Yes, I am fine with the current state, thanks for all the work! |
|
Cherry-pick to 5.0 970af7d |
|
There are lone (the plain In other words: what will break if the |
|
Furthermore, is the |
I believe it is not actually neeeded. Indeed, the |
|
Yes, I'll add the removal of Alas, the internet doesn't quite have the archives to be able to see the precise history, but |
This alpha does not contain ocaml/ocaml#11007, but dune only uses ">= 5.0.0" as a test for this feature. So they should not be coinstalled.
Fixes #10810
The idea is to keep up-to-date META files for the compiler libraries (
stdlib,compiler-libs,threads,unix,stranddynlink), and install them alongside the compiler. The advantage is that these META files don't need to be kept up-to-date separately byfindliband Dune, lowering the maintenance burden.The META files (which have been mostly copied from a recent OPAM version) are installed as follows (recall the
+stands for the stdlib directory):+META.stdlib+META.unix+META.dynlink+META.str+compiler-libs/META+threads/METAThe suffix containing the library name follows a Findlib convention that allows
ocamlfindto use them directly.Note bene. For this PR to be of any use,
ocamlfind, Dune andopamwill need to be adapted:ocamlfindwill need to add+to its "search path" and will have to stop installing its own META files+to its "search path" and stop using its collection of built-in META files, andopamwill have to make sure to install the compiler META files.As I am not myself a heavy user of
opamandocamlfindwe need this PR to be reviewed by an ecosystem expert. cc @kit-ty-kate @dbuenzli @dra27