Skip to content
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

Improved support for build-time Fl_dynload ? #44

Open
ejgallego opened this issue May 19, 2022 · 4 comments
Open

Improved support for build-time Fl_dynload ? #44

ejgallego opened this issue May 19, 2022 · 4 comments

Comments

@ejgallego
Copy link

Dear findlib maintainers,

in Coq we have started to use Fl_dynload to allow the loading of Coq's plugins that have dependencies. Also, this means we identify our plugin namespace with findlib's namespace which I think is a good think.

However, we are facing some limitations to make this work at build-time with dune (so we can compose packages, etc...)

In particular, when generating the build rules for a .v file that depends on a plugin, we need to translate a findlib library name pkg.foo to the plugin .cmxs file, while we are in the build layout. We face two problems here:

  • findlib's package path is determined at initialization time, moreover it seems we can use some of the API without calling init and init will be called automatically. Should maybe the contract be made stronger? Would a more dynamic handling of the include path make sense?

  • a critical problem is that Dune generates _build/default/META.coq-core , however that file is not usable as it is meant to be installed in _build/install/lib/coq-core/META, thus findlib will complain that a top-level directory field is missing. Would making the API more flexible make sense?

  • an alternative choice would be to depend on installed plugins and libraries, however that may be problematic for Dune's build / install phase separation. On the other hand, maybe that is what we should do, as the scheme Coq has adopted requires plugins to be public (which is IMHO a bit unfortunate, but that's an orthogonal problem)

cc @Alizter @rgrinberg @gares

@gares
Copy link

gares commented May 19, 2022

I think dune should generate two META files, one META.coq-core for the build layout (with the directory directive) and another one for the installed layout, in a hidden place.

@ejgallego
Copy link
Author

@gares that would be nice, but I'm not sure it is possible. In the build layout, users are free to setup their sources in a lot of different ways, that's not going to work always with ocamlfind I'm afraid. In fact, I now realize that what I propose would only work for Coq and not in general. So we are in bad spot.

@Alizter
Copy link

Alizter commented May 20, 2022

We could always fork/vendor findlib ourselves giving us full control and saving the findlib maintainers from having to resolve our qualms.

@gares
Copy link

gares commented May 20, 2022

The file META.coq-core produced by dune in the source tree is not usable by findlib. As I said elsewhere, this is a bug.
I don't think it makes sense to ask findlib to tolerate it.

users are free to setup their sources in a lot of different ways, that's not going to work always with ocamlfind I'm afraid.

If a user puts an invalid META file in his sources, it is not our problem. Also, if you have a META.pkg-name file at the root of your project, dune complains (since there is an hard coded rule to produce it), so I'm not sure this scenario is possible at all.

We could always fork/vendor findlib ourselves giving us full control and saving the findlib maintainers from having to resolve our qualms.

vendoring a patched copy of the META file parser is surely a way to circumvent the bug in dune, but frankly it would make more sense to patch dune. It can surely generate a META.pkg with the directory directive, and a META.pkg.for-install which is then symlinked in the _build/install folder. I don't see the difficulty with that, really.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants