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

Support OCaml 5 #10

Open
tjammer opened this issue Jan 7, 2023 · 4 comments
Open

Support OCaml 5 #10

tjammer opened this issue Jan 7, 2023 · 4 comments

Comments

@tjammer
Copy link

tjammer commented Jan 7, 2023

ppx_cstubs does not support OCaml 5.
I tried installing with opam on a fresh OCaml 5 switch and got the following error:

[ERROR] Package conflict!
  * No agreement on the version of ocaml:
    - (invariant) → ocaml = 5.0.0
    - ppx_cstubs → ocaml < 4.08.0
    You can temporarily relax the switch invariant with `--update-invariant'
  * Missing dependency:
    - ppx_cstubs → ppx_tools_versioned >= 5.4.0 → ocaml-migrate-parsetree <
      2.0.0 → ocaml-variants = 4.08.0+beta2 → ocaml-beta
    unmet availability conditions: 'enable-ocaml-beta-repository'
  * Missing dependency:
    - ppx_cstubs → ppx_tools_versioned >= 5.4.0 → ocaml-migrate-parsetree <
      2.0.0 → ocaml-variants = 4.08.0+beta3 → ocaml-beta
    unmet availability conditions: 'enable-ocaml-beta-repository'

No solution found, exiting

Would be nice to use this going forward, the bitmask feature in particular is nice

@sidkshatriya
Copy link
Contributor

sidkshatriya commented Apr 4, 2023

ppx_cstubs seems to work well with OCaml 5.

I've been trying it out recently and everything seems to work fine. I'm not sure if there would be any subtle issues with OCaml 5. I am assuming that you're running in a single domain -- I don't know what happens when you go to the multiple domain case.

For best results, try to install ppx_cstubs first in a fresh switch and work from there.

Edit: Installing in a switch directly does not work. It needs to be pinned. See comment below

@sidkshatriya
Copy link
Contributor

sidkshatriya commented Apr 4, 2023

P.S. I tried to follow my own instructions above and I get a similar error you opened the ticket with :-) . Sorry, my bad.

Here is the way I've been able to get this to work with OCaml 5:

$ mkdir my_fresh_switch
$ cd my_fresh_switch
$ opam switch create . 5.0.0 -y
$ git clone https://github.com/fdopen/ppx_cstubs.git
$ cd ppx_cstubs
$ opam pin . -y
$ cd ..
# Now ppx_cstubs is available in this switch for OCaml code that might want to use it
$ mkdir <your-own-ocaml-project>
...
...

There might be some issues with the .opam file in the opam repository -- I haven't explored this. @fdopen will probably be able to speak to this authoritatively.

@tjammer
Copy link
Author

tjammer commented Apr 14, 2023

Curious,
the opam file in this repo and in the opam repo indeed differ by two version constraints.

@@ -11,13 +11,13 @@
 ]
 depends: [
   "bigarray-compat"
-  "ctypes" {>= "0.13.0"}
+  "ctypes" {>= "0.13.0" & < "0.21"}
   "integers"
   "num"
   "result"
   "containers" {>= "2.2"}
   "cppo" {build & >= "1.3"}
-  "ocaml" {>= "4.04.2"}
+  "ocaml" {>= "4.04.2" & < "4.15"}
   "ppxlib" {>= "0.22.0"}
   "ocamlfind" {>= "1.7.2"} # not only a build dependency, it depends on findlib.top
   "dune" {>= "1.6"}

However, for the 0.7 release, the version constraints have been removed (1562e75)
Then that's a bug in the opam file in the opam repository.
This also means we don't even need any changes in ppx_cstubs or even a new release to support OCaml 5. All we need is a PR to the opam repo to fix the version constraints.

@fdopen It seems you are busy at the moment, would you be ok with me creating the PR?

@fdopen
Copy link
Owner

fdopen commented Apr 14, 2023

Yes, go ahead.

tjammer added a commit to tjammer/opam-repository that referenced this issue Apr 14, 2023
The one in the opam repo has two version constraints which make it
impossible to use with OCaml 5. The opam file in the ppx_cstubs repo at
the 0.7 tag doesn't have
them (https://github.com/fdopen/ppx_cstubs/blob/0.7.0/ppx_cstubs.opam).
This PR removes the version constraint to fix this, see relevant
discussion here fdopen/ppx_cstubs#10
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