New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tidy up installation-directory/lib/ocaml #1569
Conversation
Why would the stdlib not be in its own directory too? |
When this MR is accepted, could you propose an MR in ocamlfind in order to update |
No strong reason. I had to stop somewhere to see what people think about this, I don't know if some people might be accessing this directory other than through the search path and I had some trouble last I tried making such a change because it wasn't clear what to do with the files in lib/ocaml that were installed there but not part of the stdlib like topdirs.cmi. Though for that last problem, I ran into the same thing with compiler-libs and driver/{main,opt-main}.* being installed for some unclear reason, so I left these in compiler-libs. Presumably the same thing would work.
I'm not very familiar with ocamlfind, but I can take a stab at it. |
65b7b50
to
e8ed13f
Compare
I rebased this, thought it conflicted a lot so I could have introduced problems. Any taker for review (I recommend commit by commit)? This would still be a useful change. |
8125ac9
to
a7b7f6e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a first pass over the code, which seems fine, modulo the few small comments. More generally:
-
Commits 1, 2, 6, and 7 are cleanups/fixes which could be merged independently of this PR. I would suggest splitting them into a separate PR which would be merged quickly.
-
stdlib
should be installed in its own directory as well. -
This patch will break any tool that assumes the current layout of the
ocamlc -where
directory. Am not sure how significant the risk is here.
Changes
Outdated
@@ -119,6 +119,11 @@ Working version | |||
|
|||
### Compiler distribution build system: | |||
|
|||
- GPR#1569: install bigarray,dynlink,graphics,raw_spacetime_lib,str,unix each | |||
in a separate directory, and add these directories to the initial search path | |||
unless -nostdincludes is given. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-nostdincludes -> -nostdinclude
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing you simply want the commit introducing the flag to be consistent about the plural vs singular, rather than necessarily use the singular version? Given that we have multiple include directories, it seems slightly better to keep the plural.
;; | ||
|
||
let mk_nostdinclude f = | ||
"-nostdincludes", Arg.Unit f, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"-nostdincludes" -> "-nostdinclude"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same response as in Changes
.
otherlibs/Makefile
Outdated
@@ -80,23 +80,25 @@ $(LIBNAME).cmxs: $(LIBNAME).cmxa lib$(CLIBNAME).$(A) | |||
lib$(CLIBNAME).$(A): $(COBJS) | |||
$(MKLIB) -oc $(CLIBNAME) $(COBJS) $(LDOPTS) | |||
|
|||
MKDIR=mkdir -p | |||
install:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If reinstalling over an existing installation, the "old" otherlibs in $(INSTALL_LIBDIR)
should be removed here to avoid confusing the compiler. See #1724 for a similar fix for the switch to the packed Stdlib
.
Idem for dynlink
and compilerlibs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum. Is there any reason to install over an existing installation directory? Is deleting the whole $(INSTALL_LIBDIR)
directory in the install
phony target possible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reinstalling over an existing installation is common when installing ocaml
manually (ie without opam
, under Windows, etc): see e.g. https://caml.inria.fr/mantis/view.php?id=7773.
Not sure if it is very friendly to outright delete the destination directory. In any case it is a change that should be documented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I tried to delete only the relevant cmi,cmx.
Makefile
Outdated
for suf in $(3); do \ | ||
if test -f $$d$$suf; then $(INSTALL_DATA) $$d$$suf "$(1)"; fi; \ | ||
done; \ | ||
done \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shorter and faster:
install_into = \
$(MKDIR) "$(1)" && \
for suf in $(3); do \
$(INSTALL_DATA) $(addsuffix $$suf,$(2)) "$(1)"; \
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I don't like make
function much, I find they often make the code harder to read; but I don't have a very strong argument against using one here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure? When I try this, I get errors like install: cannot stat 'parsing/parsetree.cmt': No such file or directory
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(this .cmt doesn't exist because there is no .ml, which is fine, we simply shouldn't fail trying to install it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, it is a bit more complicated than what I suggested.
Still I think it would be a good idea to avoid having one invocation per filename -- process creation is notoriously inefficient on some platforms (e.g. Cygwin).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I couldn't find any filter-existing-files function, but test -f should not spawn, so we can probably filter file by file, and then do one big install call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After much struggle trying to understand how makefiles work, I have something that does one call to install per call to install_into.
utils/clflags.ml
Outdated
in | ||
prefix ^ Filename.quote dir | ||
) (libs_in_path ()) | ||
;; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would write
let std_include_flags prefix =
List.map (fun dir -> prefix ^ Filename.quote dir) (std_include_dirs ())
for less repetition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, not sure why I didn't write it this way in the first place.
8cc9787
to
259563f
Compare
Thanks. I should have either taken your remarks into account or replied. And see #1875. I noticed that actually the ocamldoc library was installed alongside the rest, not as a subdirectory. So I created a subdirectory for it too, and added it to the list of directories treated in a backwards compatible way, since I think this is what ocamldoc plugins compile against. I made a separate directory the stdlib. Now the only ocaml code that's directly in lib/ocaml is std_exit.* (hardcoded in the compilers), and profiling.* (ocamlprof runtime). I haven't tested much, but at least I can link programs. I've never written nor seen tools that depend on the layout of the installation directory. The change to the stdlib increases the risk of tooling built against compiler-libs breaking, but that's not very different to any other compiler-libs change. |
At the very least, |
Personally I am worried by the amount of user scripts that may break because of this, especially people who have maintained their software since the pre-widespread-ocamlfind days. I think that we should evaluate the impact of this PR on at least the opam universe before merging. (The opam universe is a debatable choice, as it contains much fewer "old buildsystem cruft" than the full OCaml ecosystem, but it is the street lamp under which to search our keys.) |
Is there a step-by-step guide somewhere on how to test a PR against opam? (@trefis?) We should probably include one in HACKING.adoc somewhere. |
Nope, as far as I can tell it's still mostly impossible to do this (in a reliable fashion) unless you're @avsm (or @samoht). My hope is that once opam-ci is "ready", there'll be a way for maintainers of ocaml/ocaml to add a target to the build matrice for a given PR and diff the results against the base of the PR (i.e. trunk or a specific branch). |
Also, I should say that this PR seems (to me) like a must have, and Valentin seems to have given some thought to the backward compatibility story (but I have thought about it, nor reviewed the PR). Also, there are potentially breaking changes with every release, and I don't think this one deserves more worry than any other (on the contrary). |
@nojb I think ocamlfind only needs updating to support -nostdincludes (except for the compiler-libs libraries), doesn't it? If you say What do you think needs adapting in What would break is: |
I'm not saying it is not satisfactory, but I still get goosebumps thinking about compatibility, so I would like to get it tested. (Maybe once the Menhir thing has settled it would be time to get back to our project of merging the best parts of Fabrice and Damien's scripts to get an opam-checker for normal people.) |
@dbuenzli it's supposed to work fine, and I tried and it's fine. What does break currently is that topdirs.cmi is not in the search, making the opam generated .ocamlinit not type check. But that's a mistake. |
The error comes from ocaml#1680, which changed the install scripts for ocamldoc, and was caught and reported by Valentin "sliquister" Gatien-Baron, presumably as part of his own work on ocaml#1569.
@sliquister yes I read too quickly and deleted my comment but apparently email notifications fire immediately. |
0b6a1c3
to
005a13f
Compare
This latest batch of changes should have addressed all remarks, and fixed the topdirs.cmi issue. I was thinking it's actually not hard to parse |
Also I don't see the logic behind putting ocamlcommon, ocamltoplevel, etc, in separate places. These libraries are all part of the same (conceptual) package. |
@xavierleroy on the other hand the current situation regarding bigarray is not great either: in order to use |
@xavierleroy if someone has -I +bigarray in their build flags, they need to specify bigarray.cmxa at link time, so removing the bigarray library would break compability because the cmxa is gone, not because of the extra pointless -I (which causes no issues). For the compiler libs, if you use them, you use and link a subset of ocamlcommon, ocamlbytecomp, ocamltoplevel etc, not all of them. |
To some extent, yes. It's the other evolution that breaks: moving some of the otherlibs into the standard library.
Yes, that's why I put the appropriate .cmas on the command line, not all of them. It doesn't follow that they should be installed separate directories. Those libraries share a bunch of .cmis. Everything should be in the same directory. |
Specifying include directories and archive files manually is not very practical though, especially when you consider the transitive dependencies. Since ocamlfind was introduced, the vast majority of projects have been specifying their dependencies as library names. A library name cover both what is visible to the typer and what will be used during linking, so the two should match. |
I don't understand. If bigarray is in the stdlib directory, then you build this way:
If bigarray gets merged, then you do:
so either you keep If bigarray is in a separate dir, you build this way:
If bigarray gets merged, then you do:
but this works perfectly fine too:
so the compatibility is the same regardless of whether bigarray is installed in the installation directory of the stdlib.
Do they share cmis? When I look at the modules of all cmxa in compiler-libs, I see no overlap. So the only possible overlap would be for mli without ml (since they wouldn't be listed), but I highly doubt we'd have overlap for specifically such files. |
Another way to solve this problem would be to provide a DSL to represent the initial typing environment. We already have such a DSL, but it is limited to including directories and opening modules, which is not very flexible. What I'm proposing is simply to extend it and provide a syntax for it. This way we wouldn't have to change anything in the way the compiler install files and third-party tools such as dune or other build system could expose the model of their choice to the user. Here is what such as DSL could look like: module Stdlib__list = "+stdlib__list.cmi"
module Stdlib__string = "+stdlib__string.cmi"
...
module Stdlib = "+stdlib.cmi"
open Stdlib
module My_module = "./my_module.cmi"
... |
This sounds like you are going in the direction of my old module namespace proposals. |
@diml currently I don't think you can easily tell which library the .cmi of .mli without .ml, like compiler-libs/annot.cmi, are from. There aren't hundreds of them, but it's kind of annoying, and the set does change from times to times. While not critical, it's also just simpler to understand the structure if not everything goes in one or two directories. I could also remove all the changes other than to Makefiles, make the layout configurable and keep the default unchanged: make install SEPARATE=true. I find that worse, but for me, being able to split out libraries is more important than making it the default, and I need none of all the compatibility stuff, it's purely there to support the change of default. |
@gasche indeed, your proposal looks ambitious though :)
Agreed.
Yh, I find having an option here worse as well. It's more things to test and maintain. |
@xavierleroy I can provide feedback for this method as we tried to do that for Camlp4. The current release story for Camlp4 is a pain as it needs two opam packages for every new release of OCaml. It is painful for the person doing the Camlp4 releases (me) and it has been the cause of plenty of hard to debug problems in the past for users. About a year or two after Camlp4 was split off the distribution, we tried to use a more classic installation layout to avoid this duplication; it was a disaster so we had to go back. Moving forward, installing things in separate directories will make the process of splitting things off from the core distribution a lot smoother. |
I'd like to express that there's strong user support for this. It's quite common to see users get late errors when linking executables due to the absence of archives for |
…ry named after the library Diff of the installation directory: @@ -50,13 +50,16 @@ ./lib/ocaml/arrayLabels.mli ./lib/ocaml/array.ml ./lib/ocaml/array.mli -./lib/ocaml/bigarray.a -./lib/ocaml/bigarray.cma -./lib/ocaml/bigarray.cmi -./lib/ocaml/bigarray.cmti -./lib/ocaml/bigarray.cmx -./lib/ocaml/bigarray.cmxa -./lib/ocaml/bigarray.cmxs +./lib/ocaml/bigarray +./lib/ocaml/bigarray/bigarray.a +./lib/ocaml/bigarray/bigarray.cma +./lib/ocaml/bigarray/bigarray.cmi +./lib/ocaml/bigarray/bigarray.cmti +./lib/ocaml/bigarray/bigarray.cmx +./lib/ocaml/bigarray/bigarray.cmxa +./lib/ocaml/bigarray/bigarray.cmxs +./lib/ocaml/bigarray/bigarray.mli +./lib/ocaml/bigarray/libbigarray.a ./lib/ocaml/bigarray.ml ./lib/ocaml/bigarray.mli ./lib/ocaml/buffer.ml @@ -1346,13 +1349,14 @@ ./lib/ocaml/complex.mli ./lib/ocaml/digest.ml ./lib/ocaml/digest.mli -./lib/ocaml/dynlink.a -./lib/ocaml/dynlink.cma -./lib/ocaml/dynlink.cmi -./lib/ocaml/dynlink.cmti -./lib/ocaml/dynlink.cmx -./lib/ocaml/dynlink.cmxa -./lib/ocaml/dynlink.mli +./lib/ocaml/dynlink +./lib/ocaml/dynlink/dynlink.a +./lib/ocaml/dynlink/dynlink.cma +./lib/ocaml/dynlink/dynlink.cmi +./lib/ocaml/dynlink/dynlink.cmti +./lib/ocaml/dynlink/dynlink.cmx +./lib/ocaml/dynlink/dynlink.cmxa +./lib/ocaml/dynlink/dynlink.mli ./lib/ocaml/ephemeron.ml ./lib/ocaml/ephemeron.mli ./lib/ocaml/expunge @@ -1367,18 +1371,20 @@ ./lib/ocaml/gc.mli ./lib/ocaml/genlex.ml ./lib/ocaml/genlex.mli -./lib/ocaml/graphics.a -./lib/ocaml/graphics.cma -./lib/ocaml/graphics.cmi -./lib/ocaml/graphics.cmti -./lib/ocaml/graphics.cmx -./lib/ocaml/graphics.cmxa -./lib/ocaml/graphics.cmxs -./lib/ocaml/graphics.mli -./lib/ocaml/graphicsX11.cmi -./lib/ocaml/graphicsX11.cmti -./lib/ocaml/graphicsX11.cmx -./lib/ocaml/graphicsX11.mli +./lib/ocaml/graphics +./lib/ocaml/graphics/graphics.a +./lib/ocaml/graphics/graphics.cma +./lib/ocaml/graphics/graphics.cmi +./lib/ocaml/graphics/graphics.cmti +./lib/ocaml/graphics/graphics.cmx +./lib/ocaml/graphics/graphics.cmxa +./lib/ocaml/graphics/graphics.cmxs +./lib/ocaml/graphics/graphics.mli +./lib/ocaml/graphics/graphicsX11.cmi +./lib/ocaml/graphics/graphicsX11.cmti +./lib/ocaml/graphics/graphicsX11.cmx +./lib/ocaml/graphics/graphicsX11.mli +./lib/ocaml/graphics/libgraphics.a ./lib/ocaml/hashtbl.ml ./lib/ocaml/hashtbl.mli ./lib/ocaml/int32.ml @@ -1394,16 +1400,11 @@ ./lib/ocaml/libasmrund.a ./lib/ocaml/libasmruni.a ./lib/ocaml/libasmrunp.a -./lib/ocaml/libbigarray.a ./lib/ocaml/libcamlrun.a ./lib/ocaml/libcamlrund.a ./lib/ocaml/libcamlruni.a -./lib/ocaml/libcamlstr.a -./lib/ocaml/libgraphics.a -./lib/ocaml/libraw_spacetime_lib.a ./lib/ocaml/libthreads.a ./lib/ocaml/libthreadsnat.a -./lib/ocaml/libunix.a ./lib/ocaml/listLabels.ml ./lib/ocaml/listLabels.mli ./lib/ocaml/list.ml @@ -1542,14 +1543,16 @@ ./lib/ocaml/queue.mli ./lib/ocaml/random.ml ./lib/ocaml/random.mli -./lib/ocaml/raw_spacetime_lib.a -./lib/ocaml/raw_spacetime_lib.cma -./lib/ocaml/raw_spacetime_lib.cmi -./lib/ocaml/raw_spacetime_lib.cmti -./lib/ocaml/raw_spacetime_lib.cmx -./lib/ocaml/raw_spacetime_lib.cmxa -./lib/ocaml/raw_spacetime_lib.cmxs -./lib/ocaml/raw_spacetime_lib.mli +./lib/ocaml/raw_spacetime_lib +./lib/ocaml/raw_spacetime_lib/libraw_spacetime_lib.a +./lib/ocaml/raw_spacetime_lib/raw_spacetime_lib.a +./lib/ocaml/raw_spacetime_lib/raw_spacetime_lib.cma +./lib/ocaml/raw_spacetime_lib/raw_spacetime_lib.cmi +./lib/ocaml/raw_spacetime_lib/raw_spacetime_lib.cmti +./lib/ocaml/raw_spacetime_lib/raw_spacetime_lib.cmx +./lib/ocaml/raw_spacetime_lib/raw_spacetime_lib.cmxa +./lib/ocaml/raw_spacetime_lib/raw_spacetime_lib.cmxs +./lib/ocaml/raw_spacetime_lib/raw_spacetime_lib.mli ./lib/ocaml/scanf.ml ./lib/ocaml/scanf.mli ./lib/ocaml/seq.ml @@ -1874,20 +1877,22 @@ ./lib/ocaml/stdlib__weak.cmx ./lib/ocaml/stdlib__weak.p.cmt ./lib/ocaml/stdlib__weak.p.cmx -./lib/ocaml/str.a -./lib/ocaml/str.cma -./lib/ocaml/str.cmi -./lib/ocaml/str.cmti -./lib/ocaml/str.cmx -./lib/ocaml/str.cmxa -./lib/ocaml/str.cmxs +./lib/ocaml/str ./lib/ocaml/stream.ml ./lib/ocaml/stream.mli ./lib/ocaml/stringLabels.ml ./lib/ocaml/stringLabels.mli ./lib/ocaml/string.ml ./lib/ocaml/string.mli -./lib/ocaml/str.mli +./lib/ocaml/str/libcamlstr.a +./lib/ocaml/str/str.a +./lib/ocaml/str/str.cma +./lib/ocaml/str/str.cmi +./lib/ocaml/str/str.cmti +./lib/ocaml/str/str.cmx +./lib/ocaml/str/str.cmxa +./lib/ocaml/str/str.cmxs +./lib/ocaml/str/str.mli ./lib/ocaml/stublibs ./lib/ocaml/stublibs/dllbigarray.so ./lib/ocaml/stublibs/dllcamlstr.so @@ -1930,18 +1935,20 @@ ./lib/ocaml/topdirs.mli ./lib/ocaml/uchar.ml ./lib/ocaml/uchar.mli -./lib/ocaml/unix.a -./lib/ocaml/unix.cma -./lib/ocaml/unix.cmi -./lib/ocaml/unix.cmti -./lib/ocaml/unix.cmx -./lib/ocaml/unix.cmxa -./lib/ocaml/unix.cmxs -./lib/ocaml/unixLabels.cmi -./lib/ocaml/unixLabels.cmti -./lib/ocaml/unixLabels.cmx -./lib/ocaml/unixLabels.mli -./lib/ocaml/unix.mli +./lib/ocaml/unix +./lib/ocaml/unix/libunix.a +./lib/ocaml/unix/unix.a +./lib/ocaml/unix/unix.cma +./lib/ocaml/unix/unix.cmi +./lib/ocaml/unix/unix.cmti +./lib/ocaml/unix/unix.cmx +./lib/ocaml/unix/unix.cmxa +./lib/ocaml/unix/unix.cmxs +./lib/ocaml/unix/unixLabels.cmi +./lib/ocaml/unix/unixLabels.cmti +./lib/ocaml/unix/unixLabels.cmx +./lib/ocaml/unix/unixLabels.mli +./lib/ocaml/unix/unix.mli ./lib/ocaml/VERSION ./lib/ocaml/vmthreads ./lib/ocaml/vmthreads/condition.cmi
After make world world.opt ocamlnat install: $ diff -u <(cd installed-5-*; find | sort) <(cd installed-6-*; find | sed 's#lib/ocaml/ocaml[^d][^/]*#lib/ocaml/compiler-libs#' | sort) --- /dev/fd/63 2018-07-02 20:46:23.854637526 -0400 +++ /dev/fd/62 2018-07-02 20:46:23.854637526 -0400 @@ -176,6 +176,11 @@ ./lib/ocaml/char.ml ./lib/ocaml/char.mli ./lib/ocaml/compiler-libs +./lib/ocaml/compiler-libs +./lib/ocaml/compiler-libs +./lib/ocaml/compiler-libs +./lib/ocaml/compiler-libs +./lib/ocaml/compiler-libs ./lib/ocaml/compiler-libs/afl_instrument.cmi ./lib/ocaml/compiler-libs/afl_instrument.cmt ./lib/ocaml/compiler-libs/afl_instrument.cmti @@ -255,6 +260,11 @@ ./lib/ocaml/compiler-libs/augment_specialised_args.cmti ./lib/ocaml/compiler-libs/augment_specialised_args.cmx ./lib/ocaml/compiler-libs/augment_specialised_args.mli +./lib/ocaml/compiler-libs/available_regs.cmi +./lib/ocaml/compiler-libs/available_regs.cmt +./lib/ocaml/compiler-libs/available_regs.cmti +./lib/ocaml/compiler-libs/available_regs.cmx +./lib/ocaml/compiler-libs/available_regs.mli ./lib/ocaml/compiler-libs/backend_intf.cmi ./lib/ocaml/compiler-libs/backend_intf.cmti ./lib/ocaml/compiler-libs/backend_intf.mli @@ -535,8 +545,6 @@ ./lib/ocaml/compiler-libs/export_info_for_pack.cmx ./lib/ocaml/compiler-libs/export_info_for_pack.mli ./lib/ocaml/compiler-libs/export_info.mli -./lib/ocaml/compiler-libs/expunge.cmi -./lib/ocaml/compiler-libs/expunge.cmt ./lib/ocaml/compiler-libs/extract_projections.cmi ./lib/ocaml/compiler-libs/extract_projections.cmt ./lib/ocaml/compiler-libs/extract_projections.cmti @@ -578,8 +586,13 @@ ./lib/ocaml/compiler-libs/freshening.cmx ./lib/ocaml/compiler-libs/freshening.mli ./lib/ocaml/compiler-libs/genprintval.cmi +./lib/ocaml/compiler-libs/genprintval.cmi +./lib/ocaml/compiler-libs/genprintval.cmt ./lib/ocaml/compiler-libs/genprintval.cmt ./lib/ocaml/compiler-libs/genprintval.cmti +./lib/ocaml/compiler-libs/genprintval.cmti +./lib/ocaml/compiler-libs/genprintval.cmx +./lib/ocaml/compiler-libs/genprintval.mli ./lib/ocaml/compiler-libs/genprintval.mli ./lib/ocaml/compiler-libs/ident.cmi ./lib/ocaml/compiler-libs/ident.cmt @@ -841,14 +854,17 @@ ./lib/ocaml/compiler-libs/opttopdirs.cmi ./lib/ocaml/compiler-libs/opttopdirs.cmt ./lib/ocaml/compiler-libs/opttopdirs.cmti +./lib/ocaml/compiler-libs/opttopdirs.cmx ./lib/ocaml/compiler-libs/opttopdirs.mli ./lib/ocaml/compiler-libs/opttoploop.cmi ./lib/ocaml/compiler-libs/opttoploop.cmt ./lib/ocaml/compiler-libs/opttoploop.cmti +./lib/ocaml/compiler-libs/opttoploop.cmx ./lib/ocaml/compiler-libs/opttoploop.mli ./lib/ocaml/compiler-libs/opttopmain.cmi ./lib/ocaml/compiler-libs/opttopmain.cmt ./lib/ocaml/compiler-libs/opttopmain.cmti +./lib/ocaml/compiler-libs/opttopmain.cmx ./lib/ocaml/compiler-libs/opttopmain.mli ./lib/ocaml/compiler-libs/opttopstart.cmi ./lib/ocaml/compiler-libs/opttopstart.cmt @@ -985,11 +1001,21 @@ ./lib/ocaml/compiler-libs/ref_to_variables.cmti ./lib/ocaml/compiler-libs/ref_to_variables.cmx ./lib/ocaml/compiler-libs/ref_to_variables.mli +./lib/ocaml/compiler-libs/reg_availability_set.cmi +./lib/ocaml/compiler-libs/reg_availability_set.cmt +./lib/ocaml/compiler-libs/reg_availability_set.cmti +./lib/ocaml/compiler-libs/reg_availability_set.cmx +./lib/ocaml/compiler-libs/reg_availability_set.mli ./lib/ocaml/compiler-libs/reg.cmi ./lib/ocaml/compiler-libs/reg.cmt ./lib/ocaml/compiler-libs/reg.cmti ./lib/ocaml/compiler-libs/reg.cmx ./lib/ocaml/compiler-libs/reg.mli +./lib/ocaml/compiler-libs/reg_with_debug_info.cmi +./lib/ocaml/compiler-libs/reg_with_debug_info.cmt +./lib/ocaml/compiler-libs/reg_with_debug_info.cmti +./lib/ocaml/compiler-libs/reg_with_debug_info.cmx +./lib/ocaml/compiler-libs/reg_with_debug_info.mli ./lib/ocaml/compiler-libs/reload.cmi ./lib/ocaml/compiler-libs/reload.cmt ./lib/ocaml/compiler-libs/reload.cmti $ for v in ocamlcommon ocamlbytecomp ocamloptcomp ocamltoplevel ocamlopttoplevel compiler-libs; do echo "-------- $v"; (cd installed-6-*/lib/ocaml/$v; ls -1 *.cmi); echo; done -------- ocamlcommon annot.cmi arg_helper.cmi ast_helper.cmi ast_invariants.cmi ast_iterator.cmi ast_mapper.cmi asttypes.cmi attr_helper.cmi btype.cmi build_path_prefix_map.cmi builtin_attributes.cmi bytesections.cmi ccomp.cmi clflags.cmi cmi_format.cmi cmt_format.cmi compdynlink.cmi compenv.cmi compmisc.cmi compplugin.cmi config.cmi consistbl.cmi ctype.cmi datarepr.cmi depend.cmi dll.cmi docstrings.cmi envaux.cmi env.cmi ident.cmi identifiable.cmi includeclass.cmi includecore.cmi includemod.cmi lambda.cmi lexer.cmi location.cmi longident.cmi main_args.cmi makedepend.cmi matching.cmi meta.cmi misc.cmi mtype.cmi numbers.cmi opcodes.cmi oprint.cmi outcometree.cmi parmatch.cmi parse.cmi parser.cmi parsetree.cmi path.cmi pparse.cmi pprintast.cmi predef.cmi primitive.cmi printast.cmi printlambda.cmi printpat.cmi printtyp.cmi printtyped.cmi profile.cmi rec_check.cmi runtimedef.cmi semantics_of_primitives.cmi simplif.cmi strongly_connected_components.cmi stypes.cmi subst.cmi switch.cmi symtable.cmi syntaxerr.cmi targetint.cmi tast_mapper.cmi tbl.cmi terminfo.cmi translattribute.cmi translclass.cmi translcore.cmi translmod.cmi translobj.cmi translprim.cmi typeclass.cmi typecore.cmi typedecl.cmi typedtree.cmi typedtreeIter.cmi typedtreeMap.cmi typemod.cmi typeopt.cmi types.cmi typetexp.cmi untypeast.cmi warnings.cmi -------- ocamlbytecomp bytegen.cmi bytelibrarian.cmi bytelink.cmi bytepackager.cmi cmo_format.cmi compile.cmi emitcode.cmi errors.cmi instruct.cmi printinstr.cmi -------- ocamloptcomp afl_instrument.cmi alias_analysis.cmi allocated_const.cmi arch.cmi asmgen.cmi asmlibrarian.cmi asmlink.cmi asmpackager.cmi augment_specialised_args.cmi available_regs.cmi backend_intf.cmi branch_relaxation.cmi branch_relaxation_intf.cmi build_export_info.cmi clambda.cmi closure.cmi closure_conversion_aux.cmi closure_conversion.cmi closure_element.cmi closure_id.cmi closure_offsets.cmi closure_origin.cmi cmm.cmi cmmgen.cmi cmx_format.cmi coloring.cmi comballoc.cmi compilation_unit.cmi compilenv.cmi CSE.cmi CSEgen.cmi deadcode.cmi debuginfo.cmi effect_analysis.cmi emitaux.cmi emit.cmi export_id.cmi export_info.cmi export_info_for_pack.cmi extract_projections.cmi find_recursive_functions.cmi flambda.cmi flambda_invariants.cmi flambda_iterators.cmi flambda_to_clambda.cmi flambda_utils.cmi freshening.cmi id_types.cmi import_approx.cmi inconstant_idents.cmi initialize_symbol_to_let_symbol.cmi inline_and_simplify_aux.cmi inline_and_simplify.cmi inlining_cost.cmi inlining_decision.cmi inlining_decision_intf.cmi inlining_stats.cmi inlining_stats_types.cmi inlining_transforms.cmi interf.cmi internal_variable_names.cmi interval.cmi invariant_params.cmi lift_code.cmi lift_constants.cmi lift_let_to_initialize_symbol.cmi linearize.cmi linkage_name.cmi linscan.cmi liveness.cmi mach.cmi middle_end.cmi mutable_variable.cmi optcompile.cmi opterrors.cmi parameter.cmi pass_wrapper.cmi printclambda.cmi printcmm.cmi printlinear.cmi printmach.cmi proc.cmi projection.cmi ref_to_variables.cmi reg_availability_set.cmi reg.cmi reg_with_debug_info.cmi reload.cmi reloadgen.cmi remove_free_vars_equal_to_args.cmi remove_unused_arguments.cmi remove_unused_closure_vars.cmi remove_unused_program_constructs.cmi schedgen.cmi scheduling.cmi selectgen.cmi selection.cmi set_of_closures_id.cmi set_of_closures_origin.cmi share_constants.cmi simple_value_approx.cmi simplify_boxed_integer_ops.cmi simplify_boxed_integer_ops_intf.cmi simplify_common.cmi simplify_primitives.cmi spacetime_profiling.cmi spill.cmi split.cmi static_exception.cmi strmatch.cmi symbol.cmi tag.cmi traverse_for_exported_symbols.cmi un_anf.cmi unbox_closures.cmi unbox_free_vars_of_closures.cmi unbox_specialised_args.cmi variable.cmi var_within_closure.cmi x86_ast.cmi x86_dsl.cmi x86_gas.cmi x86_masm.cmi x86_proc.cmi -------- ocamltoplevel genprintval.cmi topdirs.cmi toploop.cmi topmain.cmi trace.cmi -------- ocamlopttoplevel genprintval.cmi opttopdirs.cmi opttoploop.cmi opttopmain.cmi -------- compiler-libs main.cmi optmain.cmi opttopstart.cmi topstart.cmi
@xavierleroy given the replies to your remarks, do you still have reservations about this pull request? Knowing would help decide what to do with it. |
The way most libraries of the compiler distribution are installed right now is by putting all their files in $PREFIX/lib/ocaml, or $PREFIX/lib/ocaml/compiler-libs for the libraries of the compiler (the exceptions being threads, ocamldoc and before camlp4).
This is annoying because it's desirable for a build system to prevent a library foo from building against a library bar if foo doesn't declare a dependency on bar (by not putting bar in the search path). And this works great, except when bar is a compiler library like str or unix because they are in the search path and there's nothing the build system can do about it.
This results in link time errors instead of "unbound module" errors, both with the normal ocaml compilers and with js_of_ocaml, and potentially for a user of the bad library rather than an author of the bad library.
The same thing happens with compiler-libs, when declaring a dependency on ocamlcommon and using ocamltoplevel.
I propose solving this by installing all libraries in their own subdirectory of $PREFIX/lib/ocaml
(except stdlib). For backwards compatibility, the search path contains +unix, +str etc by default, which can be turned off with a new flag -nostdincludes which I would use.I didn't implement any compatibility for compiler-libs, as code that links with these libs tends to break on every new compiler version anyway.I made-I +compiler-libs
expand to-I +ocamlcommon -I +ocamltoplevel ..
for compatibility.