jscert / jsexplain

Apache License 2.0
26 stars 4 forks source link

Project doesn’t compile as-is #56

Closed Mbodin closed 5 years ago

Mbodin commented 5 years ago

I tried to make the project compile and failed. Here are some comments:

=== ERROR while compiling jsexplain.1.0 ======================================

context 2.0.4 | linux/x86_64 | ocaml-base-compiler.4.04.2 | git+https://github.com/jscert/opam-repository.git#add-pkg-fjs_of_fml

path /path/to/opam/jsexplain/.opam-switch/build/jsexplain.1.0

command /path/to/opam/opam-init/hooks/sandbox.sh build make

exit-code 2

env-file /path/to/opam/log/jsexplain-15557-8415c4.env

output-file /path/to/opam/log/jsexplain-15557-8415c4.out

output

[...]

checking for ocamllex.opt... ocamllex.opt

checking for ocamlyacc... ocamlyacc

checking for ocamlweb... true

checking platform... configure: creating ./config.status

config.status: creating Makefile

make -C jsref mljsref

make[1]: Entering directory '/path/to/opam/jsexplain/.opam-switch/build/jsexplain.1.0/jsref'

Makefile:59: .depends: No such file or directory

Makefile:52: *** Missing generator tools, build from project root, or set paths.. Stop.

make[1]: Leaving directory '/path/to/opam/jsexplain/.opam-switch/build/jsexplain.1.0/jsref'

Makefile:36: recipe for target 'mljsref' failed

make: *** [mljsref] Error 2


* `make init` fails (as well as in Travis: https://travis-ci.org/jscert/jsexplain/jobs/467411985 ).
* The following line https://github.com/jscert/jsexplain/blob/master/jsref/Makefile.in#L18 in /path/to/opam/jsexplain/.opam-switch/build/jsexplain.1.0/jsref has been replaced by `GENERATOR_DIR = no`. I guess that some script is replacing `@GENERATOR_DIR@` to its correct value, but here silently failed.
* The associated README is weak. A merge failure has been left there for some time in the final file: https://github.com/jscert/jsexplain/commit/f25da5a59d73159bd5a988d408eb8c4112ca6758 This leaves me without much clue on how to solve the issue.
If you have any pointer that could help, I would greatly appreciate.
barockobamo commented 5 years ago

At this point you should be able to use driver.html in the build path as well as in ~/.opam/jsexplain/share/jsexplain/driver.html

Mbodin commented 5 years ago

Thanks for the tips. Unfortunately, it still doesn’t work.

During the compilation of fjs_of_fml (step 1):

$ make opam_install 
eval $(opam env)
ocamlbuild -j 4 -classic-display -use-ocamlfind -I src -I src/stdlib_fml -no-hygiene fjs_of_fml.byte
ocamlfind ocamlc -c -bin-annot -package str -package compiler-libs.common -I src -I src/stdlib_fml -o src/fjs_of_fml.cmi src/fjs_of_fml.mli
+ ocamlfind ocamlc -c -bin-annot -package str -package compiler-libs.common -I src -I src/stdlib_fml -o src/fjs_of_fml.cmi src/fjs_of_fml.mli
findlib: [WARNING] Interface topdirs.cmi occurs in several directories: /usr/lib/ocaml/compiler-libs, /usr/lib/ocaml
File "src/fjs_of_fml.mli", line 1:
Error: /usr/lib/ocaml/compiler-libs/env.cmi
is not a compiled interface for this version of OCaml.
It seems to be for an older version of OCaml.
Command exited with code 2.
Makefile:96: recipe for target 'fjs_of_fml.byte' failed
make: *** [fjs_of_fml.byte] Error 10

It seems that the Makefile of fjs_of_fml is shortcutting Opam’s links to directly use the system’s libraries with Opam’s OCaml compiler. As they are from different OCaml version and it doesn’t work.

My next step was to remove my system’s ocaml-compiler-libs library and install it in Opam for OCaml 4.07.1:

# apt remove ocaml-compiler-libs
$ opam install ocaml-compiler-libs

Now I get this error:

$ make opam_install 
eval $(opam env)
ocamlbuild -j 4 -classic-display -use-ocamlfind -I src -I src/stdlib_fml -no-hygiene fjs_of_fml.byte
make: ocamlbuild: Command not found
Makefile:96: recipe for target 'fjs_of_fml.byte' failed
make: *** [fjs_of_fml.byte] Error 127

So installing ocamlbuild within Opam:

$ opam install ocamlbuild

I now get this error:

$ make opam_install 
eval $(opam env)
ocamlbuild -j 4 -classic-display -use-ocamlfind -I src -I src/stdlib_fml -no-hygiene fjs_of_fml.byte
ocamlfind ocamlc -c -bin-annot -package str -package compiler-libs.common -I src -I src/stdlib_fml -o src/fjs_of_fml.cmi src/fjs_of_fml.mli
+ ocamlfind ocamlc -c -bin-annot -package str -package compiler-libs.common -I src -I src/stdlib_fml -o src/fjs_of_fml.cmi src/fjs_of_fml.mli
File "src/fjs_of_fml.mli", line 5, characters 26-31:
Error: Unbound module Env
Command exited with code 2.
Makefile:96: recipe for target 'fjs_of_fml.byte' failed
make: *** [fjs_of_fml.byte] Error 10

I have no idea which path I am missing to compile this Env module ☹

For step 2, I got this error message:

$ opam pin -yn add JS_Parser "https://github.com/resource-reasoning/JS_Parser.git#v0.1.0"
Package JS_Parser does not exist, create as a NEW package? [Y/n] y
[JS_Parser.~dev] synchronised from git+https://github.com/resource-reasoning/JS_Parser.git#v0.1.0
[WARNING] Failed checks on JS_Parser package definition from source at git+https://github.com/resource-reasoning/JS_Parser.git#v0.1.0:
    error 57: Synopsis and description must not be both empty
JS_Parser is now pinned to git+https://github.com/resource-reasoning/JS_Parser.git#v0.1.0 (version 0.1.0)

I use Opam 2.0.4: do you think that it might be the reason why I get this error?

The command line opam install -y JS_Parser then seems to work.

barockobamo commented 5 years ago
Mbodin commented 5 years ago

Thanks for the swift answer! The error must indeed have been from an uncleaned repository: after the clean-up, it now builds. Thanks again! ☺

brabalan commented 5 years ago

We need to update the README on this repo, but jsexplain is now hosted at https://gitlab.inria.fr/star-explain