Stream: Elpi users & devs

Topic: Elpi on Windows


view this post on Zulip Michael Soegtrop (Sep 15 2020 at 12:59):

As it looks the windows opam repo is lacking patches for the two latest elpi releases 1.11.3 and 1.11.4. See: https://github.com/fdopen/opam-repository-mingw/tree/opam2/packages/elpi. Up to 1.11.2 there are patches.

@Enrico Tassi : are you aware of these patches? They don't look difficult - I think they are about removal of temporary files and probably also would work under other platforms. I am not sure why the author of the opam mingw repo doesn't push these upstream.

I am not sure if 1.11.3 / 1.11.4 needs more changes than this and I am also not so sure how this would be best tested.

view this post on Zulip Enrico Tassi (Sep 15 2020 at 13:28):

I was not aware of that. I'm happy to integrate them upstream.

view this post on Zulip Michael Soegtrop (Sep 15 2020 at 14:05):

I'm happy to integrate them upstream.

Thanks, this helps! I am currently doing a Windows test build of 1.11.4 with the same patch as for 1.11.2.

view this post on Zulip Enrico Tassi (Sep 15 2020 at 14:54):

FYI: https://github.com/LPCIC/elpi/pull/88 to have a CI run. I'm merging it in master, but master already contains more changes. If you really need a point release I can make it, otherwise it will wait some time.
thanks for the heads up!

view this post on Zulip Enrico Tassi (Sep 15 2020 at 14:55):

But I don't have a windows CI instance, so your feedback on that platform is welcome

view this post on Zulip Michael Soegtrop (Sep 15 2020 at 17:10):

From looking at the patches, what should I look out for when testing?

view this post on Zulip Enrico Tassi (Sep 15 2020 at 18:54):

If it compiles, then it's fine. The patch is only about the compilation.

view this post on Zulip Enrico Tassi (Sep 15 2020 at 18:54):

Also coq-elpi contains a test suite that is compiled by default...

view this post on Zulip Michael Soegtrop (Sep 15 2020 at 19:12):

OK - I had only a very quick look and it looked like some temp file auto removal stuff which was automatic on Linux and explicit on Windows, but I looked at only for a 10 seconds.

view this post on Zulip Michael Soegtrop (Sep 15 2020 at 19:30):

@Enrico Tassi : There is one more issue on Windows - the good old shasum vs. sha1sum story. The story is: shasum is (on Windows and Linux - need to check macOS) a Perl script. It does exist and works from the shell, but a MinGW app cannot run a Perl script via a OCaml system. So on Windows sha1sum works, but shasum not - isn't it great? I really need to replace the system command of OCaml on Windows - I have somethign which does she-bang analysis and is reasonably posix compliant.

What would you suggest to do? The options I see are:

1.) Install sha1sum on Mac via MacPorts or homebrew (via an opam conf package and depext)
2.) Hack my Windows build cygwin so that shasum is an executable (I could just copy sha1sum into the priority bin folder)
3.) Use some OCaml OS level preprocessing to choose between sha1sum and shasum depending on OS

2.) is easy but has the disadvnatage that the opam pachage does not work outside of my build environment on Windows then. 3.) is a hack so I tend towards 1.)

Sorry for the mess - I should have tested the shasum patch on Windows but I just tested that it exists and works on the shell.

view this post on Zulip Enrico Tassi (Sep 15 2020 at 19:39):

Now that I think at it, if the problem is portability, then the easiest is to use ocaml's md5 instead. It is part of the standard library, and I need no crypto safety properties, it's just a check the cache is not about an outdated file. You need no "exec" for that, just a call to Digest.file https://caml.inria.fr/pub/docs/manual-ocaml/libref/Digest.html I can write a patch tomorrow.

view this post on Zulip Enrico Tassi (Sep 15 2020 at 19:47):

Easier done than explained: https://github.com/LPCIC/elpi/pull/89

view this post on Zulip Enrico Tassi (Sep 15 2020 at 19:48):

I'll backport the patch to the released version in a minute

view this post on Zulip Enrico Tassi (Sep 15 2020 at 19:52):

There it is: https://github.com/LPCIC/elpi/commit/652e8a892963949d6d9245c3e5cb252010b14b78
This commit should apply on the tag v1.11.4 and solve your problems. I hope you can apply this via opam.

view this post on Zulip Michael Soegtrop (Sep 15 2020 at 21:46):

@Enrico Tassi : thanks for the quick fix - indeed I think that using an OCaml library function makes our lives much easier. It shouldn't be a problem to apply the patch via opam. Shall I push the opam package under the same version number (1.11.4) upstream?

view this post on Zulip Enrico Tassi (Sep 15 2020 at 21:50):

I guess it's fine to keep the same version.

view this post on Zulip Michael Soegtrop (Sep 16 2020 at 13:20):

@Enrico Tassi : you didn't add the Windows temp file patch (as far as I can tell). Shall I add it as patch to the main opam repo as well? As far as I can tell with both patches Elip works fine on Windows - at least hierarchy-builder does compile.

view this post on Zulip Enrico Tassi (Sep 16 2020 at 13:32):

Great. No I did not add the patch to the main opam archive. Sorry, I still don't get how the platform builds, I thougt you had a custom repo.

view this post on Zulip Enrico Tassi (Sep 16 2020 at 13:34):

I think I should then call the package 1.11.4-1, Iguess they don't let change an already merged package

view this post on Zulip Michael Soegtrop (Sep 16 2020 at 13:44):

I thougt you had a custom repo.

Yes, the platform has a patch repo, but this is only intended for temporary patches until things are merged upstream - without this things would take much longer. So I first put it in the patch repo, test it, if it is fine I do a PR upstream and if this is merged I remove it from the patch repo. Ocaml (non Coq) opam packages like Elpi are more complicated because they also need to be merged to the MinGW fork of the opam repo, which can take a two weeks.

view this post on Zulip Enrico Tassi (Sep 16 2020 at 13:50):

Here the PR: https://github.com/ocaml/opam-repository/pull/17214


Last updated: Feb 05 2023 at 13:02 UTC