Skip to content

Compile error on OCaml 5.4.0 #332

@brianwk

Description

@brianwk

I am unable to add the server-reason-react dependency to my project using OCaml 5.4.0.

ontext: _private
(cd _build/default && /Users/briankaplan/.cache/dune/toolchains/ocaml-compiler.5.4.0-f7fa36f38f7d3c2fb8acb68b4a13da4d/target/bin/ocamlc.opt -w -40 -g -bin-annot -bin-annot-occurrences -I packages/Js/lib/.js.objs/byte -I /Users/briankaplan/.cache/dune/toolchains/ocaml-compiler.5.4.0-f7fa36f38f7d3c2fb8acb68b4a13da4d/target/lib/ocaml/str -I /Users/briankaplan/.cache/dune/toolchains/ocaml-compiler.5.4.0-f7fa36f38f7d3c2fb8acb68b4a13da4d/target/lib/ocaml/unix -I /Users/briankaplan/dev-current/executor-full-stack/_build/_private/default/.pkg/lwt/target/lib/lwt -I /Users/briankaplan/dev-current/executor-full-stack/_build/_private/default/.pkg/quickjs/target/lib/quickjs -I /Users/briankaplan/dev-current/executor-full-stack/_build/_private/default/.pkg/uucp/target/lib/uucp -I /Users/briankaplan/dev-current/executor-full-stack/_build/_private/default/.pkg/zarith/target/lib/zarith -cmi-file packages/Js/lib/.js.objs/byte/js__Js_re.cmi -no-alias-deps -open Js__ -o packages/Js/lib/.js.objs/byte/js__Js_re.cmo -c -impl packages/Js/lib/Js_re.pp.ml)
File "packages/Js/lib/Js_re.ml", line 37, characters 57-84:
37 | let setLastIndex : t -> int -> unit = fun regex index -> Quickjs.RegExp.setLastIndex regex index
                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Unbound value Quickjs.RegExp.setLastIndex
(cd _build/default && /Users/briankaplan/.cache/dune/toolchains/ocaml-compiler.5.4.0-f7fa36f38f7d3c2fb8acb68b4a13da4d/target/bin/ocamlc.opt -w -40 -w -9 -g -bin-annot -bin-annot-occurrences -I packages/browser-ppx/.browser_ppx.objs/byte -I /Users/briankaplan/dev-current/executor-full-stack/_build/_private/default/.pkg/ppxlib/target/lib/ppxlib -I /Users/briankaplan/dev-current/executor-full-stack/_build/_private/default/.pkg/ppxlib/target/lib/ppxlib/ast -I /Users/briankaplan/dev-current/executor-full-stack/_build/_private/default/.pkg/ppxlib/target/lib/ppxlib/astlib -no-alias-deps -open Browser_ppx -o packages/browser-ppx/.browser_ppx.objs/byte/browser_ppx__Ppx.cmo -c -impl packages/browser-ppx/ppx.pp.ml)
File "packages/browser-ppx/ppx.ml", line 56, characters 4-12:
56 |   | Pexp_fun (arg_label, _arg_expression, fun_pattern, expression) ->
         ^^^^^^^^
Error: This variant pattern is expected to have type Ppxlib.expression_desc
       There is no constructor Pexp_fun within type Ppxlib.expression_desc
Hint:             Did you mean Pexp_for?
(cd _build/default && /Users/briankaplan/.cache/dune/toolchains/ocaml-compiler.5.4.0-f7fa36f38f7d3c2fb8acb68b4a13da4d/target/bin/ocamlc.opt -w -40 -w -9 -g -bin-annot -bin-annot-occurrences -I packages/melange.ppx/.melange_native_ppx.objs/byte -I /Users/briankaplan/.cache/dune/toolchains/ocaml-compiler.5.4.0-f7fa36f38f7d3c2fb8acb68b4a13da4d/target/lib/ocaml/str -I /Users/briankaplan/dev-current/executor-full-stack/_build/_private/default/.pkg/ppxlib/target/lib/ppxlib -I /Users/briankaplan/dev-current/executor-full-stack/_build/_private/default/.pkg/ppxlib/target/lib/ppxlib/ast -I /Users/briankaplan/dev-current/executor-full-stack/_build/_private/default/.pkg/ppxlib/target/lib/ppxlib/astlib -I /Users/briankaplan/dev-current/executor-full-stack/_build/_private/default/.pkg/quickjs/target/lib/quickjs -I packages/melange.ppx/base32/lib/.base32.objs/byte -I packages/melange.ppx/xxhash/.xxhash.objs/byte -no-alias-deps -open Melange_native_ppx -o packages/melange.ppx/.melange_native_ppx.objs/byte/melange_native_ppx__Ppx.cmo -c -impl packages/melange.ppx/ppx.pp.ml)
File "packages/melange.ppx/ppx.ml", line 540, characters 6-14:
540 |     | Pexp_fun (_, _, _, expr) -> go expr.pexp_desc
            ^^^^^^^^
Error: This variant pattern is expected to have type Ppxlib.expression_desc
       There is no constructor Pexp_fun within type Ppxlib.expression_desc
Hint:             Did you mean Pexp_for?
(cd _build/default && /Users/briankaplan/.cache/dune/toolchains/ocaml-compiler.5.4.0-f7fa36f38f7d3c2fb8acb68b4a13da4d/target/bin/ocamlopt.opt -w -40 -g -I packages/Js/lib/.js.objs/byte -I packages/Js/lib/.js.objs/native -I /Users/briankaplan/.cache/dune/toolchains/ocaml-compiler.5.4.0-f7fa36f38f7d3c2fb8acb68b4a13da4d/target/lib/ocaml/str -I /Users/briankaplan/.cache/dune/toolchains/ocaml-compiler.5.4.0-f7fa36f38f7d3c2fb8acb68b4a13da4d/target/lib/ocaml/unix -I /Users/briankaplan/dev-current/executor-full-stack/_build/_private/default/.pkg/lwt/target/lib/lwt -I /Users/briankaplan/dev-current/executor-full-stack/_build/_private/default/.pkg/quickjs/target/lib/quickjs -I /Users/briankaplan/dev-current/executor-full-stack/_build/_private/default/.pkg/uucp/target/lib/uucp -I /Users/briankaplan/dev-current/executor-full-stack/_build/_private/default/.pkg/zarith/target/lib/zarith -cmi-file packages/Js/lib/.js.objs/byte/js__Js_re.cmi -no-alias-deps -open Js__ -o packages/Js/lib/.js.objs/native/js__Js_re.cmx -c -impl packages/Js/lib/Js_re.pp.ml)
File "packages/Js/lib/Js_re.ml", line 37, characters 57-84:
37 | let setLastIndex : t -> int -> unit = fun regex index -> Quickjs.RegExp.setLastIndex regex index
                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Unbound value Quickjs.RegExp.setLastIndex
-> required by _build/_private/default/.pkg/server-reason-react/target
-> required by library "executor.tilia" in _build/default/common/src/Tilia
-> required by library "executor.ui" in _build/default/ui/src
Had 1 error, waiting for filesystem changes...

I have the repository pinned in my dune file and that's how I'm installing it. This is my dune-project file: https://github.com/Software-Deployed/executor/blob/ocaml/dune-project -- I'm using OCaml 5.4.0 and Melange 6.0.1-54. I'm using 5.4.0 because it's the latest stable release of OCaml and I am under the impression it's necessary to run Melange 6.

Once I remove the server-reason-react dependency from Dune and I run dune pkg lock the dune build command succeeds.

I was thinking to try to list the subpackages from the repository individually instead of installing all of server-reason-react. Since this error is coming from the browser_ppx module.

I tried many different things to get it to work. I pinned using opam pin command. Also in my dune-project you will see reason-react 0.17.0 and reason-react-ppx 0.17.0. I pinned these using opam pin --with-version since I believe 0.17.0 isn't released on opam yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions