ocsigen / js_of_ocaml

Compiler from OCaml to Javascript.
http://ocsigen.org/js_of_ocaml/
Other
968 stars 188 forks source link

In Which Ty Has Issues Getting Js_of_ocaml To Build #808

Closed TyOverby closed 5 years ago

TyOverby commented 5 years ago

I wanted to make a switch for use during js_of_ocaml development, but installing a switch fails.

Same thing happens for 4.07.1

$ opam switch create ./ 4.06.1

<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫 
[ocaml-base-compiler.4.06.1] downloaded from cache at https://opam.ocaml.org/cache

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫 
∗ installed base-bigarray.base
∗ installed base-threads.base
∗ installed base-unix.base
Processing  7/12: [ocaml-base-compiler: make world.opt]
∗ installed ocaml-base-compiler.4.06.1
∗ installed ocaml-config.1
∗ installed ocaml.4.06.1
Done.
# Run eval $(opam env) to update the current shell environment
js_of_ocaml is now pinned to git+file:///Users/tyoverby/workspace/ocaml/js_of_ocaml#master (version 3.4.0)
js_of_ocaml-tyxml is now pinned to git+file:///Users/tyoverby/workspace/ocaml/js_of_ocaml#master (version 3.4.0)
js_of_ocaml-toplevel is now pinned to git+file:///Users/tyoverby/workspace/ocaml/js_of_ocaml#master (version 3.4.0)
js_of_ocaml-ppx_deriving_json is now pinned to git+file:///Users/tyoverby/workspace/ocaml/js_of_ocaml#master (version 3.4.0)
js_of_ocaml-ppx is now pinned to git+file:///Users/tyoverby/workspace/ocaml/js_of_ocaml#master (version 3.4.0)
js_of_ocaml-ocamlbuild is now pinned to git+file:///Users/tyoverby/workspace/ocaml/js_of_ocaml#master (version 3.1.0)
js_of_ocaml-lwt is now pinned to git+file:///Users/tyoverby/workspace/ocaml/js_of_ocaml#master (version 3.4.0)
js_of_ocaml-compiler is now pinned to git+file:///Users/tyoverby/workspace/ocaml/js_of_ocaml#master (version 3.4.0)
The following dependencies couldn't be met:
  - js_of_ocaml-lwt → js_of_ocaml-ppx → ocaml-migrate-parsetree >= 1.3.1
      no matching version
TyOverby commented 5 years ago

If I try this with ocaml.4.07.1, it fails with the same thing, and then trying to install metaquot fails with

Tys-MacBook-Pro-2:js_of_ocaml tyoverby$ dune build 
       ocaml (internal)
ocamlfind: Package `graphics' not found
File "ppx/ppx_js/lib/dune", line 10, characters 19-51:
10 |   (preprocess (pps ppx_tools_versioned.metaquot_407)))
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Library "ppx_tools_versioned.metaquot_407" not found.
Hint: try: dune external-lib-deps --missing @@default
File "ppx/ppx_js/lib_internal/dune", line 7, characters 19-51:
7 |   (preprocess (pps ppx_tools_versioned.metaquot_407)))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Library "ppx_tools_versioned.metaquot_407" not found.
Hint: try: dune external-lib-deps --missing @@default
TyOverby commented 5 years ago

Ignoring those errors, cding into the compiler directory and running dune build @check yields the following errors:

$ dune build @check
Entering directory '/Users/tyoverby/workspace/ocaml/js_of_ocaml'
      ocamlc compiler/.js_of_ocaml.eobjs/byte/empty-findlib.{cmi,cmo,cmt} (exit 2)
(cd _build/default && /usr/local/bin/ocamlc.opt -w @a-4-29-40-41-42-44-45-48-58-59-60-40 -strict-sequence -strict-formats -short-paths -keep-locs -w +a-4-40-41-42-44-48-58-66 -safe-string -g -bin-annot -I compiler/.js_of_ocaml.eobjs/byte -I /Users/tyoverby/workspace/ocaml/js_of_ocaml/_opam/lib/biniou -I /Users/tyoverby/workspace/ocaml/js_of_ocaml/_opam/lib/bytes -I /Users/tyoverby/workspace/ocaml/js_of_ocaml/_opam/lib/cmdliner -I /Users/tyoverby/workspace/ocaml/js_of_ocaml/_opam/lib/easy-format -I /Users/tyoverby/workspace/ocaml/js_of_ocaml/_opam/lib/findlib -I /Users/tyoverby/workspace/ocaml/js_of_ocaml/_opam/lib/yojson -I /usr/local/lib/ocaml/compiler-libs -I compiler/findlib-support/.jsoo_findlib_support.objs/byte -I compiler/findlib-support/.jsoo_findlib_support.objs/native -I compiler/lib/.js_of_ocaml_compiler.objs/byte -I compiler/lib/.js_of_ocaml_compiler.objs/native -no-alias-deps -opaque -o compiler/.js_of_ocaml.eobjs/byte/empty-findlib.cmo -c -impl compiler/empty-findlib.ml)File "compiler/empty-findlib.ml", line 1:Error (warning 24): bad source file name: "Empty-findlib" is not a valid module name
TyOverby commented 5 years ago

Also, merlin seems to think that some of the libraries are built with an out-of-date compiler?

/Users/tyoverby/.opam/4.07.0/lib/ppx_expect/collector/expect_test_collector.cmi is not a compiled interface for this version of OCaml. It seems to be f
or an older version of OCaml.
hhugo commented 5 years ago

What opam version do you use ? you should aim at 2.04 Is you opam up to date ? (opam update)

The following worked for me.

opam switch create ./ 4.06.1
eval $(opam env)
opam install menhir
make
TyOverby commented 5 years ago

I'm using opam 2.0.4, Is that the same as 2.04?

$ opam --version
2.0.4
hhugo commented 5 years ago

Yes. That was typo.

TyOverby commented 5 years ago

After installing everything, attempting to build the compiler yields this:

tyoverby@editor:~/workspace/ocaml/js_of_ocaml/compiler$ dune build -w                                                                                                                                                                 
  Entering directory '/home/tyoverby/workspace/ocaml/js_of_ocaml'                                                                                                        
  Error: Hash collision between set of ppx drivers:                                                                                                                      
  - cache : ppx_optcomp_light (in project: js_of_ocaml)                                                                                                                  
  - fetch : ppx_optcomp_light (in project: js_of_ocaml)                                                                                                                  
  Had errors, waiting for filesystem changes...
hhugo commented 5 years ago

@TyOverby, what version of dune do you use ? @diml, @rgrinberg, is that error familiar to you ?

ghost commented 5 years ago

We fixed a couple of bugs in Dune related to this in the past, but it's possible one remains.

TyOverby commented 5 years ago

@diml I tried to install dune from master and I get this

tyoverby@editor:~/workspace/ocaml/js_of_ocaml$ opam install ../dune
dune is now pinned to git+file:///home/tyoverby/workspace/ocaml/dune#terminal-resets-inbetween-build (version 1.10.0)
dune-build-info is now pinned to git+file:///home/tyoverby/workspace/ocaml/dune#terminal-resets-inbetween-build (version ~dev)
The following dependencies couldn't be met:
  - dune-build-info → dune >= 1.11
      no matching version

No solution found, exiting
ghost commented 5 years ago

Dune 1.11 was just released yesterday, you can now install it normally via opam.