ppx_cstubs
ppx_cstubs copied to clipboard
Support OCaml 5
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
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
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.
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 (https://github.com/fdopen/ppx_cstubs/commit/1562e75e81b028f40ff2118ab509fd1e60ed2ec3) 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?
Yes, go ahead.