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

Update unison.opam #1100

Merged
merged 1 commit into from
Dec 20, 2024
Merged

Update unison.opam #1100

merged 1 commit into from
Dec 20, 2024

Conversation

tleedjarv
Copy link
Contributor

Disclaimer: I don't know what I am doing, as I don't use opam myself.

@gdt
Copy link
Collaborator

gdt commented Dec 19, 2024

That makes two of us! I'll merge this after 26 0Z December, unless there are contrary comments.

@jhjourdan
Copy link
Contributor

Any reason why the NATIVE variable is no longer used on the build command line? From what I can remember, unison failed to build on machines where no native version of ocaml is installed, and Opam CI checks this.

@jhjourdan
Copy link
Contributor

Apart from this, I don't think this patch would cause breakage when building on unix platforms. For Windows, we'll have to test, but I don't have a Windows machine at hand, so I can't check.

What I do usually is wait for a unison release to happen, then I submit the package on the opam repo, and Opam CI is telling me if there is any reasonable platform where the build fails. If something breaks, I'll patch the file on Opam repo, and submit a PR here.

For the latest release, Windows broke, so I disabled Windows support temporarilly (I don't think it ever worked, Windows support for Opam is very recent). Thank's to this PR, it may finally work ;)

@tleedjarv
Copy link
Contributor Author

Any reason why the NATIVE variable is no longer used on the build command line? From what I can remember, unison failed to build on machines where no native version of ocaml is installed, and Opam CI checks this.

This was fixed. There is now automatic fallback to ocamlc if ocamlopt is not found. NATIVE should only be used for manual override now. If this is not desired or if it proves to work unreliably then this part of the change can be reverted.

@tleedjarv
Copy link
Contributor Author

For the latest release, Windows broke, so I disabled Windows support temporarilly (I don't think it ever worked, Windows support for Opam is very recent). Thank's to this PR, it may finally work ;)

That's true. All this work was inspired by the recent Windows support in Opam. I believe the GUI builds will still fail as cairo2 and lablgtk3 are missing some patches (our CI workflow adds those patches during building, that's why it works here).

@jhjourdan
Copy link
Contributor

This was fixed. There is now automatic fallback to ocamlc if ocamlopt is not found. NATIVE should only be used for manual override now. If this is not desired or if it proves to work unreliably then this part of the change can be reverted.

Then I would prefer if the change is reverted. Opam installations are typically the cases where the detection of ocamlop can fail, because it may be installed on the system, but not onthe opam switch. In this case, the ocamlopt command exists, but does not refer to the opam installation.

@jhjourdan
Copy link
Contributor

That's true. All this work was inspired by the recent Windows support in Opam. I believe the GUI builds will still fail as cairo2 and lablgtk3 are missing some patches (our CI workflow adds those patches during building, that's why it works here).

Are these patches expected to be merged any time soon? If not, then I would prefer if we could specify that the unison-gui package is incompatible with Windows. This is not ideal because if lablgtk is installed then then unison package will attempt to build the GUI even if unison-gui is not installed, but there is no simple solution to that.

Include NMAKE build option.

Do a manual install for Win32 as there is no automatic installation in
a non-POSIX environment.
@jhjourdan
Copy link
Contributor

Shouldn't the NATIVE variable be specified for installation too?

@tleedjarv
Copy link
Contributor Author

Are these patches expected to be merged any time soon?

Unfortunately, this looks unlikely. The patches in question are:
Chris00/ocaml-cairo#39
garrigue/lablgtk#165 (comment)

I don't use Windows myself, so proposed those patches as comments, not PRs, but I doubt this makes any difference.

@tleedjarv
Copy link
Contributor Author

Shouldn't the NATIVE variable be specified for installation too?

No need, the install target no longer builds anything, just copies the files. This was changed precisely to avoid building something with an unwanted conf.

@jhjourdan
Copy link
Contributor

No need, the install target no longer builds anything, just copies the files. This was changed precisely to avoid building something with an unwanted conf.

Alright, but does the set of copied files depend on this flag?

@tleedjarv
Copy link
Contributor Author

No, the NATIVE flag is pretty much just a choice between ocamlc and ocamlopt.

@jhjourdan
Copy link
Contributor

Ok, so I guess this should work.

@gdt
Copy link
Collaborator

gdt commented Dec 20, 2024

This change is now just about installing on Windows. @jhjourdan Are you happy to have this PR merged into unison now, or do you have concerns? My interpretation is that you are ok with the latest force push but I want to make sure I'm not misreading.

@jhjourdan
Copy link
Contributor

Sorry, I wasn't completely clear: I am ok with this PR.

@gdt
Copy link
Collaborator

gdt commented Dec 20, 2024

That's true. All this work was inspired by the recent Windows support in Opam. I believe the GUI builds will still fail as cairo2 and lablgtk3 are missing some patches (our CI workflow adds those patches during building, that's why it works here).

Are these patches expected to be merged any time soon? If not, then I would prefer if we could specify that the unison-gui package is incompatible with Windows. This is not ideal because if lablgtk is installed then then unison package will attempt to build the GUI even if unison-gui is not installed, but there is no simple solution to that.

This is hard to deal with. It seems that unison-gui is not actually incompatible with Windows; it's just that things fail due to upstream bugs. Someone who has installed fixed versions of dependencies should be able to build, and I don't feel right (from a Free Software doctrine viewpoint) marking it broken.

It is likely that our detection of dependencies could be improved, to reject versions with known bugs that prevent compilation, but that seems not a good use of time. It might be easier to fork and fix, but that's not clearly reasonable either.

It also seems like it should be easier to say "don't try to build foo", sort of --disable-gui, I know there are explicit targets, but that's messy with build/install, and with omitting 1 of 3, without enumerating the others. But this point is entirely separable I think, and I always try to detangle if possible.

@gdt
Copy link
Collaborator

gdt commented Dec 20, 2024

Sorry, I wasn't completely clear: I am ok with this PR.

No worries -- it was easy to ask. Thank you for the review.

@gdt gdt merged commit 09ecd94 into bcpierce00:master Dec 20, 2024
31 checks passed
@tleedjarv tleedjarv deleted the portable-make-opam branch December 20, 2024 12:02
@jhjourdan
Copy link
Contributor

This is hard to deal with. It seems that unison-gui is not actually incompatible with Windows; it's just that things fail due to upstream bugs. Someone who has installed fixed versions of dependencies should be able to build, and I don't feel right (from a Free Software doctrine viewpoint) marking it broken.

It is likely that our detection of dependencies could be improved, to reject versions with known bugs that prevent compilation, but that seems not a good use of time. It might be easier to fork and fix, but that's not clearly reasonable either.

It also seems like it should be easier to say "don't try to build foo", sort of --disable-gui, I know there are explicit targets, but that's messy with build/install, and with omitting 1 of 3, without enumerating the others. But this point is entirely separable I think, and I always try to detangle if possible.

The point here is that we are not telling that unison is incompatible with Windows. We are telling that its Opam package is, which, in effect, is true, because of the bugs in the Cairo and Lablgtk packages. Windows users, anyway, are more likely to use the Windows installer.

The whole point of Opam is to provide a plug-and-play mechanism to build and install OCaml software. I'm afraid that patching dependencies does not satisfy this requirement.

There is a general policy of Opam repository to only include packages that are known to build on platforms they support, so a package without such an annotation will not be accepted.

@gdt
Copy link
Collaborator

gdt commented Dec 20, 2024

Then we'd need to have a Big Scary Comment explaining that no, it is not that unison is incompatible, but that dependencies are buggy, a URL to the policy and URLs to the dependency bug reports.

Does Opam really not carry patches to defective packages? It seems all packaging systems, more or less, do this as finding bugs in packages that need to be fixed to allow other builds is not strange.

@jhjourdan
Copy link
Contributor

Does Opam really not carry patches to defective packages? It seems all packaging systems, more or less, do this as finding bugs in packages that need to be fixed to allow other builds is not strange.

Some packages do that, indeed. But this needs to be done in the packages of these dependencies. I am not the maintainer of the opam packages for Lablgtk and Cairo (and I don't want to start doing this), these packages are maintained by their respective developers. So I guess the easiest way to make these package include these patch is to make them merged upstream.

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

Successfully merging this pull request may close these issues.

3 participants