Conversation
|
Would it still be a breaking change if, by default, dune used findlib only if
Dune used to fail unless |
Given the drop of direct dependency on |
Why would this be desirable? Dune should simply uses findlib whenever it is present. I assume that users who have findlib installed are assuming that its settings are being fully respected.
I think there's a bit of confusion here. Dune never used findlib via the The issue in my opinion that dune is currently picking and choosing which findlib features it implements. This is why there are some limitations on things like defining toolchains in one file and allowing to set the libraries path via the ocamlfind config. In my opinion, dune should mimic findlib faithfully whenever it is available. Of course, there should be a way to turn this off. |
|
Thanks for clarifying, it all makes sense now. |
|
@rgrinberg can you think of a real scenario where this PR would change the behavior? The only I can think of is the following:
with this PR, dune would still pick up the global ocaml rather than the manually installed one. However, absolute paths in findlib.conf don't seem to be very common. For instance, the findlib.conf file installed via Given that, I tend to think that we can reasonably expect that this PR won't be noticeable for users. |
bb878f0 to
8ab9702
Compare
|
There's a couple of differences this PR brings (some are unrelated to each other):
Additionally, if we were to go ahead with this PR, I would improve the emulation of findlib further. For example, |
|
I see. Personally I'm fine with these changes. |
Does/will opam construct such a thing which people put in their global environment by way of sourcing the opam init? If so, it would conflict with local esy builds when people also happen to have an opam environment initialized. If not, I think there's no worry (that I can think of). |
Previously, toolchains were only allowed to be defined in their own files. This isn't really how findlib works at the moment. Findlib simply allows for extra configuration files to be present in the .d directory. We should simply read this directory like findlib does. Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
Does esy set the findlib config explicitly anyway? If it does, then it has nothing to worry about. The way to address the problem diml pointed out is by explicit configuration. The way I see it, dune respects the findlib configuration by default but should allow users to override it. Using absolute paths in the findlib.conf will also cause problems if we build the compiler with dune and compose it in another build. I'm ok with having users manually override their findlib installs if those are not properly configured. |
Currently, dune prefers ocamlc, ocamlopt, etc. from PATH Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
8ab9702 to
9106b31
Compare
|
@rgrinberg Esy will set findlib config explicitly as soon as we merge it (we will temporarily set OCAMLPATH as well for older |
|
Looking at the current code, whenever we have opam installed, then we use it to discover where the libraries should be sourced from rather than |
|
It does seem like we have too many entry points for the user to configure things, and it is starting to become hard to understand how all these interact between each other. Rather than fiddle around, I suggest to start a discussion with the authors of the various tools to see if we can reach an agreement. If we can agree on a blessed way to setup the environment for OCaml compilation, then we don't need to support every possible combination. |
|
Sure, I agree with that. I just thought that findlib was basically that standard already. Let me cc @andreypopp here as well. If there's a consensus from the esy team on what exactly dune should support to configure compilation environments, that would be an important step forward already. |
|
Well, that's almost true. Over the years, findlib has mostly become the standard. There is however one catch: ocamlfind is not mandatory and is not always installed. This is a big issue when you have several installations of OCaml, such as a system one, an opam one and/or an esy one on top. If we agree that variables such as There is still an issue regarding findlib.conf: currently the only way to locate it is to call |
Okay, I'm convinced that we shouldn't use findlib as the default for this reason. On the other hand, I think we should go for full findlib support whenever |
This would be most preferable. |
This helps me solve the following problem when porting for OpenBSD: The OCaml libdir on OpenBSD is ``/usr/local/lib/ocaml``. When creating binary packages the installation is made into a "fake" root, which results in a libdir like ``/usr/ports/pobj/dune-1.10.0/fake-amd64/usr/local/lib/ocaml`` Now, since the pre-dune era, we set OCAMLFIND_DESTDIR to ``/usr/local/lib/ocaml`` when building a port, but to e.g. ``/usr/ports/pobj/dune-1.10.0/fake-amd64/usr/local/lib/ocaml`` when (fake-)installing a port. This is not exactly how a ``DESTDIR`` is supposed to work, but it did the job. Now dune actually respects ``DESTDIR`` and will prepend in to ``OCAMLFIND_DESTDIR``, which will then result in ``/usr/ports/pobj/dune-1.10.0/fake-amd64/usr/ports/pobj/dune-1.10.0/fake-amd64/usr/local/lib/ocaml`` during (fake-)installation. To solves this I currently need to special treat all ports using dune and unset ``OCAMLFIND_DESTDIR`` for them. Actually ocamlfind is to be blamed here, because it gets the concept of ``DESTDIR`` wrong. I don't expect this to change. For me it would be convenient if I could directly configure dune by environment variables and bypass ocamlfind completely. This commit accomplishes this only for ``dune install``. It would be nice if dune would respect ``DUNE_LIBDIR`` for ``dune build``, too. This may be related to ocaml#1707. Here's GNU's definition of DESTDIR, LIBDIR, PREFIX and so on: https://www.gnu.org/prep/standards/html_node/DESTDIR.html https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
This helps me solve the following problem when porting for OpenBSD:
The OCaml libdir on OpenBSD is ``/usr/local/lib/ocaml``.
When creating binary packages the installation is made into a "fake"
root, which results in a libdir like
``/usr/ports/pobj/dune-1.10.0/fake-amd64/usr/local/lib/ocaml``
which is constructed from ``PREFIX`` and ``DESTDIR``:
``${DESTDIR}/${TRUEPREFIX}/lib/ocaml``
Now, since the pre-dune era, we set ``OCAMLFIND_DESTDIR`` to
``/usr/local/lib/ocaml`` when building a port, but to
``/usr/ports/pobj/dune-1.10.0/fake-amd64/usr/local/lib/ocaml``
when (fake-)installing a port. This is not exactly how a ``DESTDIR`` is supposed to
work, but it did the job.
Now dune actually respects ``DESTDIR`` and will prepend it to
``OCAMLFIND_DESTDIR``, which will then result in
``/usr/ports/pobj/dune-1.10.0/fake-amd64/usr/ports/pobj/dune-1.10.0/fake-amd64/usr/local/lib/ocaml``
during (fake-)installation, which is obviously not what I want.
To solve this I currently need to special treat all ports using dune and
unset ``OCAMLFIND_DESTDIR`` for them.
For me it would be convenient if I could directly configure dune by
environment variables and bypass ocamlfind completely.
This commit accomplishes this only for ``dune install``. It would be nice if
dune would respect ``DUNE_LIBDIR`` for ``dune build``, too.
This may be related to ocaml#1707.
Here's GNU's definition of DESTDIR, LIBDIR, PREFIX and so on:
https://www.gnu.org/prep/standards/html_node/DESTDIR.html
https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
Signed-off-by: Christopher Zimmermann <chrisz@openbsd.org>
This helps me solve the following problem when porting for OpenBSD:
The OCaml libdir on OpenBSD is ``/usr/local/lib/ocaml``.
When creating binary packages the installation is made into a "fake"
root, which results in a libdir like
``/usr/ports/pobj/dune-1.10.0/fake-amd64/usr/local/lib/ocaml``
which is constructed from ``PREFIX`` and ``DESTDIR``:
``${DESTDIR}/${TRUEPREFIX}/lib/ocaml``
Now, since the pre-dune era, we set ``OCAMLFIND_DESTDIR`` to
``/usr/local/lib/ocaml`` when building a port, but to
``/usr/ports/pobj/dune-1.10.0/fake-amd64/usr/local/lib/ocaml``
when (fake-)installing a port. This is not exactly how a ``DESTDIR`` is supposed to
work, but it did the job.
Now dune actually respects ``DESTDIR`` and will prepend it to
``OCAMLFIND_DESTDIR``, which will then result in
``/usr/ports/pobj/dune-1.10.0/fake-amd64/usr/ports/pobj/dune-1.10.0/fake-amd64/usr/local/lib/ocaml``
during (fake-)installation, which is obviously not what I want.
To solve this I currently need to special treat all ports using dune and
unset ``OCAMLFIND_DESTDIR`` for them.
For me it would be convenient if I could directly configure dune by
environment variables and bypass ocamlfind completely.
This commit accomplishes this only for ``dune install``. It would be nice if
dune would respect ``DUNE_LIBDIR`` for ``dune build``, too.
This may be related to ocaml#1707.
Here's GNU's definition of DESTDIR, LIBDIR, PREFIX and so on:
https://www.gnu.org/prep/standards/html_node/DESTDIR.html
https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
Signed-off-by: Christopher Zimmermann <madroach@gmerlin.de>
|
@jeremiedimino I'm wondering if we should revive this PR but modify a couple of things. We'll just respect |
|
Agreed that the current state is a bit wonky. Why do we need to support For cross-compilation, it feels like we could just look for |
|
I wonder if it is not used for cross-compilation in distribution. For example ocaml-mingw-w64-x86-64 defines an |
|
Ah, I wasn't aware distributions also installed such a configuration file. One idea would be to allow to configure a pattern for such configuration at compile time. That would be in-line with the optional compile-time configuration of the library path. |
To make it easy for opam-cross maintainers to adapt. IIRC, they still have non dune packages.
Let's see if @toots is fine with that.
That seems good. |
|
Cross compilation is pretty tightly tied to As a side note, we're pretty much stuck with updating |
Attempt to fix #1701
By default, dune basically uses OCAMLPATH and whatever is available in PATH. This seems a bit inconsistent and surprising as I think that most would expect dune to use whatever configuration findlib is using.
On the other hand, this is technically a breaking change. A possibility to avoid it is to turn this option off by default, and make it possible to toggle it in the workspace file. But this seems like it's just going to add entropy to an already complicated part of the code.
The first commit can be merged on its own as it's just fixing dune's ability to understand toolchains defined in the same config file.
Would like to hear some feedback about how accurately dune should emulate findlib (@nojb, @bobot, @emillon)