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
Coq's dune build/install system should distinguish ocaml libs and coq libs #15452
Comments
Here is a work-in-progress patch to try to find every place where coq doesn't find its parts: |
This is a known issue due to For now I recommend amending the |
I tried to dig into those .install files:
Can you tell me more about them? |
Oh indeed, sorry, you don't need to mess with the install files, but with the You can do
and
but for some reason lib_root doesn't point to I remember having discussed this setup with Dune devs as to extend the semantics, but I can't find the discussion in my notes yet. I have a better fix on the way, but won't happen this week given my deadlines sorry. |
Answers to your questions:
|
That's not as simple as passing -libdir /usr/lib when installing coq-stdlib: it will put the files in the right directory, but the prelude will still be searched as /usr/lib/ocaml/coq/theories/Init/Prelude.vo because that's what I gave at configure-time. |
Oh, what happens if |
Ah, the problem is that the same libdir is used for ocaml libraries, coq libraries and the plugins. So I'm still trying to find out what to set where and what to patch so everything works. There's a three-step testing to do:
Hopefully I won't discover more checking steps once I'll have those three settled... |
@SnarkBoojum let me have a look at the code that determines the location of things, we should be able to figure out if the Debian layout will work at all indeed. |
I would say part of the problem is that you have to look at the codes (plural!) that determine the location of things... duplication doesn't help there. I think I have something going with the combination of:
|
Trying to ompile coq-elpi gave me another needed modification, for the CoqMakefile system: |
Pfff... even with that, CoqMakefile.in still puts all files to install in the same FILESTOINSTALL list, and hence in the same directory... |
I'm wondering if I shouldn't have several configure-build for the various parts. |
No, there's no way I can get everything right : even if I get all of coq right (I can), that will still get anything using CoqMakefile.in wrong... So what am I left with? Coq in /usr/lib/coq and a symlink in /usr/lib/ocaml so ocaml libs get found, perhaps? |
For the record: I did the symlink trick to make everything work. Dirty, but working. |
Thanks for all the work and feedback @SnarkBoojum ; I hope we can address this properly in the hacking session scheduled for the Winter Hackathon |
@SnarkBoojum can you help me apply the symlink trick to https://github.com/JasonGross/coq-packaging/tree/master/debian? Since the findlib PR was merged, non-opam Coq (even when built without dune) seems to no longer be able to build plugins, see #15635 |
Well, that was just a case of having a debian/my_package.links to create a symlink. But it's now obsolete since I reworked the packaging. Why do you need to package coq for Ubuntu if there is already a Debian package for it? |
@JasonGross I think you can just |
Is there a debian nightly build? I have packages for every released version of Coq that I can build and automatic builds of the tip of every branch, to use on CI @gares, thanks, I'll try that |
@JasonGross ah, no, there's no nightly build ; but you could still use the debian/ directory above as a basis. |
@SnarkBoojum Ah, yeah, I could do that. Where does it live? I don't see a link to your packaging in this issue thread. |
Sorry, I mixed with another thread on github (about another package entirely...). Here is a place where you can find everything. |
@SnarkBoojum Thanks. When I look at the diff between your control file and mine, I see -Standards-Version: 3.9.5
+Standards-Version: 4.6.0
Build-Depends:
- debhelper (>= 9),
+ bash (>= 5.0),
+ debhelper-compat (= 13),
+ dh-exec,
dh-ocaml (>= 0.9.5~),
- ocaml-nox (>= 4.05.0),
- ocaml-best-compilers,
+ dh-python,
+ ocaml-dune,
+ ocaml-nox (>= 4.05),
+ ocaml-native-compilers,
ocaml-findlib (>= 1.8.0),
- dune (>= 2.5.1),
- libfindlib-ocaml-dev (>= 1.8.0),
- libzarith-ocaml-dev (>= 1.10),
- liblablgtk3-ocaml-dev (>= 3.1.0),
- liblablgtksourceview3-ocaml-dev (>= 3.1.0),
- texlive-latex-extra,
- hevea (>= 1.10-7)
+ camlp5 (>= 6.14),
+ liblablgtk3-ocaml-dev,
+ liblablgtksourceview3-ocaml-dev (>= 3.0~beta8),
+ libnum-ocaml-dev,
+ libounit-ocaml-dev,
+ libzarith-ocaml-dev,
+ python3,
+ rsync,
+ tex-common What's the reason you depend on camlp5 and libnum-ocaml-dev? I believe neither of these is required anymore. Any why not version dune and zarith and lablgtk3 and findlib with the minimum versions required by Coq? And why ocaml-dune rather than dune? And why |
Also libfindlib-ocaml-dev is needed for master |
What do we do with this bug, the problem and a workaround was proposed in #15452 (comment) Dune assumes an "Opam" layout, that is to say, |
Well, now in Debian the coq libs are in /usr/lib/ocaml/coq... which might not be ideal but makes sense... |
I think that's up to you, indeed, the OPAM layout is not generic enough IMHO (but makes sense for them to identify lib with lib/ocaml as they are an OCaml package manager) . I wonder what Nix people think about how Dune installs things @vbgl @Zimmi48 ? So I propose we either close this bug, or move it Dune's repos. |
According to the FHS, libraries can end up in various places depending on the usage -- and so do binaries (bin or libexec?) ; so indeed perhaps dune itself should be a bit less heavy-handed in its classification. |
@SnarkBoojum Dune has the following notions of install sections https://dune.readthedocs.io/en/stable/dune-files.html#install-1 Indeed, once we use Dune for more languages, I think we should make Maybe the easiest is just to keep the current sections, but add an aditional |
Is there any update on this? Has the bug been copied / moved to dune? Are there plans to support installing .vo files and OCaml files in different directories? |
I'm afraid we had no cycles to move this ahead, but if someone wants to help with this I'm happy to help / support the intiative. I wonder tho if the solution we proposed would work, for example:
|
Fixes #15609 As per coq/coq#15635 (comment), and coq/coq#15452 and coq/coq#18439, if we specify `--prefix`, we must also pass `--libdir` to `dune install` to avoid errors such as ```ocamlfind: Package `coq-core.plugins.ltac' not found``` when building Coq plugins. N.B. The value for `--libdir` is taken from `community/dune/APKBUILD`, but as per coq/coq#15635 (comment), it might be the case that `ocamlfind printconf destdir` is more correct? As per coq/coq#15635 (comment), skipping `./configure` is improper, and will cause issues in most layouts with Coq not being able to find its own standard library (apparently the previous configuration was the singular(?) exception). This should probably go away in a future version of Coq, along with `make dunestrap`, as per coq/coq#18433 (comment). Note that `-mandir` and `-docdir` are optional in this instance, since they default to `/usr/share/man` and `/usr/share/doc` respectively when `-prefix /usr` is passed. I included them to immitate the call to `dune install` below.
See coq/coq#15663 (comment) and coq/coq#15635 (comment) and coq/coq#18439. Coq lib files must be installed to the same location as ocaml-findlib lib files in order for plugins to be buildable. An alternative as per coq/coq#15452 (comment) might be ```diff diff --git a/Formula/c/coq.rb b/Formula/c/coq.rb index 580810fc3ed..ed8f82f230b 100644 --- a/Formula/c/coq.rb +++ b/Formula/c/coq.rb @@ -36,7 +36,7 @@ class Coq < Formula ENV.prepend_path "OCAMLPATH", Formula["ocaml-findlib"].opt_lib/"ocaml" system "./configure", "-prefix", prefix, "-mandir", man, - "-libdir", HOMEBREW_PREFIX/"lib/ocaml/coq", + "-libdir", HOMEBREW_PREFIX/"lib/coq", "-docdir", pkgshare/"latex" system "make", "dunestrap" system "dune", "build", "-p", "coq-core,coq-stdlib,coqide-server,coq" @@ -44,9 +44,12 @@ class Coq < Formula "--mandir=#{man}", "--libdir=#{lib}/ocaml", "coq-core", - "coq-stdlib", "coqide-server", "coq" + system "dune", "install", "--prefix=#{prefix}", + "--mandir=#{man}", + "--libdir=#{lib}/coq", + "coq-stdlib" end test do ``` Bump revision on coq and math-comp to force a rebuild.
See coq/coq#15663 (comment) and coq/coq#15635 (comment) and coq/coq#18439. Coq lib files must be installed to the same location as ocaml-findlib lib files in order for plugins to be buildable. An alternative as per coq/coq#15452 (comment) might be ```diff diff --git a/Formula/c/coq.rb b/Formula/c/coq.rb index 580810fc3ed..ed8f82f230b 100644 --- a/Formula/c/coq.rb +++ b/Formula/c/coq.rb @@ -36,7 +36,7 @@ class Coq < Formula ENV.prepend_path "OCAMLPATH", Formula["ocaml-findlib"].opt_lib/"ocaml" system "./configure", "-prefix", prefix, "-mandir", man, - "-libdir", HOMEBREW_PREFIX/"lib/ocaml/coq", + "-libdir", HOMEBREW_PREFIX/"lib/coq", "-docdir", pkgshare/"latex" system "make", "dunestrap" system "dune", "build", "-p", "coq-core,coq-stdlib,coqide-server,coq" @@ -44,9 +44,12 @@ class Coq < Formula "--mandir=#{man}", "--libdir=#{lib}/ocaml", "coq-core", - "coq-stdlib", "coqide-server", "coq" + system "dune", "install", "--prefix=#{prefix}", + "--mandir=#{man}", + "--libdir=#{lib}/coq", + "coq-stdlib" end test do ``` Bump revision on coq to force a rebuild.
Add a test to make sure that ocamlfind can find core plugins of Coq. See coq/coq#15663 (comment) and coq/coq#15635 (comment) and coq/coq#18439. Coq lib files must be installed to the same location as ocaml-findlib lib files in order for plugins to be buildable. An alternative as per coq/coq#15452 (comment) might be ```diff diff --git a/Formula/c/coq.rb b/Formula/c/coq.rb index 580810fc3ed..ed8f82f230b 100644 --- a/Formula/c/coq.rb +++ b/Formula/c/coq.rb @@ -36,7 +36,7 @@ class Coq < Formula ENV.prepend_path "OCAMLPATH", Formula["ocaml-findlib"].opt_lib/"ocaml" system "./configure", "-prefix", prefix, "-mandir", man, - "-libdir", HOMEBREW_PREFIX/"lib/ocaml/coq", + "-libdir", HOMEBREW_PREFIX/"lib/coq", "-docdir", pkgshare/"latex" system "make", "dunestrap" system "dune", "build", "-p", "coq-core,coq-stdlib,coqide-server,coq" @@ -44,9 +44,12 @@ class Coq < Formula "--mandir=#{man}", "--libdir=#{lib}/ocaml", "coq-core", - "coq-stdlib", "coqide-server", "coq" + system "dune", "install", "--prefix=#{prefix}", + "--mandir=#{man}", + "--libdir=#{lib}/coq", + "coq-stdlib" end test do ``` Bump revision on coq to force a rebuild.
This seems slightly more preferred, as per coq/coq#15452 (comment)
Add a test to make sure that ocamlfind can find core plugins of Coq. See coq/coq#15663 (comment) and coq/coq#15635 (comment) and coq/coq#18439. Coq lib files must be installed to the same location as ocaml-findlib lib files in order for plugins to be buildable. An alternative as per coq/coq#15452 (comment) might be ```diff diff --git a/Formula/c/coq.rb b/Formula/c/coq.rb index 580810fc3ed..ed8f82f230b 100644 --- a/Formula/c/coq.rb +++ b/Formula/c/coq.rb @@ -36,7 +36,7 @@ class Coq < Formula ENV.prepend_path "OCAMLPATH", Formula["ocaml-findlib"].opt_lib/"ocaml" system "./configure", "-prefix", prefix, "-mandir", man, - "-libdir", HOMEBREW_PREFIX/"lib/ocaml/coq", + "-libdir", HOMEBREW_PREFIX/"lib/coq", "-docdir", pkgshare/"latex" system "make", "dunestrap" system "dune", "build", "-p", "coq-core,coq-stdlib,coqide-server,coq" @@ -44,9 +44,12 @@ class Coq < Formula "--mandir=#{man}", "--libdir=#{lib}/ocaml", "coq-core", - "coq-stdlib", "coqide-server", "coq" + system "dune", "install", "--prefix=#{prefix}", + "--mandir=#{man}", + "--libdir=#{lib}", + "coq-stdlib" end test do ``` Bump revision on coq to force a rebuild.
This seems slightly more preferred, as per coq/coq#15452 (comment)
Add a test to make sure that ocamlfind can find core plugins of Coq. See coq/coq#15663 (comment) and coq/coq#15635 (comment) and coq/coq#18439. Coq lib files must be installed to the same location as ocaml-findlib lib files in order for plugins to be buildable. An alternative as per coq/coq#15452 (comment) might be ```diff diff --git a/Formula/c/coq.rb b/Formula/c/coq.rb index 580810fc3ed..ed8f82f230b 100644 --- a/Formula/c/coq.rb +++ b/Formula/c/coq.rb @@ -36,7 +36,7 @@ class Coq < Formula ENV.prepend_path "OCAMLPATH", Formula["ocaml-findlib"].opt_lib/"ocaml" system "./configure", "-prefix", prefix, "-mandir", man, - "-libdir", HOMEBREW_PREFIX/"lib/ocaml/coq", + "-libdir", HOMEBREW_PREFIX/"lib/coq", "-docdir", pkgshare/"latex" system "make", "dunestrap" system "dune", "build", "-p", "coq-core,coq-stdlib,coqide-server,coq" @@ -44,9 +44,12 @@ class Coq < Formula "--mandir=#{man}", "--libdir=#{lib}/ocaml", "coq-core", - "coq-stdlib", "coqide-server", "coq" + system "dune", "install", "--prefix=#{prefix}", + "--mandir=#{man}", + "--libdir=#{lib}", + "coq-stdlib" end test do ``` Bump revision on coq to force a rebuild.
This seems slightly more preferred, as per coq/coq#15452 (comment)
The matter was discussed recently on zulip, but no satisfactory solution was proposed.
With this configure line:
the build lines:
and the install line:
Then Prelude.vo ends up in /usr/lib/ocaml/coq/theories/Init/Prelude.vo, while everything looks for it in /usr/lib/ocaml/theories/Init/Prelude.vo.
There should be libdir to install the ocaml libs for coq, and a coqlibdir to install the coq libs for coq (ie: stdlib). The problem is that the dune build organisation confuses the two.
The text was updated successfully, but these errors were encountered: