0

I'm very new to OCaml and I need to build some project from the following https://github.com/janestreet/core_kernel.git. I try to compile the following source code, which named setup.ml

(* OASIS_START *)
open OASISDynRun;;
open OASISTypes;;
(* OASIS_STOP *)

let () =
  InternalInstallPlugin.lib_hook :=
    fun (cs, bs, lib) ->
      match lib.OASISTypes.lib_findlib_name with
        | Some "core_kernel" ->
            (cs, bs, lib, [])
        | _ ->
            (cs, bs, lib, [])
;;

let () = setup ()

With following command

ocamlfind ocamlopt -o $@ -linkpkg -package ocamlbuild,oasis.dynrun setup_dev.ml || ocamlfind ocamlc -o $@ -linkpkg -package ocamlbuild,oasis.dynrun setup_dev.ml || true 

Here is the error message.

File "setup_dev.ml", line 8, characters 8-21:
Error: This pattern matches values of type 'a * 'b * 'c
       but a pattern was expected which matches values of type
         OASISTypes.common_section * OASISTypes.build_section *
         OASISTypes.library * OASISTypes.unix_dirname option
File "setup_dev.ml", line 8, characters 8-21:
Error: This pattern matches values of type 'a * 'b * 'c
       but a pattern was expected which matches values of type
         OASISTypes.common_section * OASISTypes.build_section *
         OASISTypes.library * OASISTypes.unix_dirname option

If you need to take a look at _oasis file, please let me know. The reason why I use OASIS is that I need to use old version compiler (4.02.0), worrying that some deprecated syntax makes trouble. Thanks.

laurent01
  • 115
  • 8
  • 2
    What's the actual error? – glennsl Jul 15 '22 at 10:52
  • 1
    Why are you trying to use oasis when the core_kernel build system uses dune? As a build system, oasis has been mostly completely replaced by dune in the OCaml ecosystem. – octachron Jul 15 '22 at 11:07
  • (OP is presumably working with an oldish project they didn't create. Unfortunately I don't know anything about oasis so I can't suggest anything. As @glennsl says, it would be extremely helpful to see the actual error message.) – Jeffrey Scofield Jul 15 '22 at 16:54
  • dune 1.x works with 4.02, but the whole 4.x range of OCaml should also be backwards-compatible. If you use opam to install packages you should get the appropriate versions depending on the switch (compiler version) you're using. – glennsl Jul 18 '22 at 08:05
  • Do you mean should I change the version of the compiler to build core_kernel_js? – laurent01 Jul 18 '22 at 08:27
  • You shouldn't have to, but you could try that too. – glennsl Jul 18 '22 at 11:10
  • Unfortunately, I think the project is based on the oasis toolchain (https://github.com/janestreet/core_kernel/tree/111.25.00) so that I cannot try dune. The core kernel library version is designated by the top project that I want to build (https://github.com/heidihoward/ocaml-raft). So I cannot change the version. – laurent01 Jul 18 '22 at 11:18
  • Here I get the answer. The problem was the version of the oasis. https://github.com/janestreet/core_kernel/issues/106 – laurent01 Jul 19 '22 at 02:08

0 Answers0