frenetic-lang / frenetic

The Frenetic Programming Language and Runtime System
http://www.frenetic-lang.org/
Other
222 stars 52 forks source link

fail to install frenetic with opam #653

Closed tylovehhx closed 1 year ago

tylovehhx commented 1 year ago

hello,

I'm trying to install frenetic, and I run in to some issues.

First, there is an error ' Error: Library "mparser.re" not found.', but I already installed mparser 1.3. Besids, there is also ' Error: Unbound type constructor json'

How can I fix it?

Thanks a lot.

opam install frenetic
The following actions will be performed:
  ∗ install frenetic 5.0.3

<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[frenetic.5.0.3] found in cache

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
+ /home/ty/.opam/opam-init/hooks/sandbox.sh "build" "jbuilder" "build" "-p" "frenetic" "-j" "95" (CWD=/home/ty/.opam/4.06.0/.opam-switch/build/frenetic.5.0.3)
- File "src/lib/async/jbuild", line 17, characters 5-15:
- Error: Library "mparser.re" not found.
- Hint: try: jbuilder external-lib-deps --missing -p frenetic @install
-       ocamlc src/lib/netkat/.frenetic_netkat.objs/frenetic_netkat__Json.{cmi,cmti} (exit 2)
- (cd _build/default && /home/ty/.opam/4.06.0/bin/ocamlc.opt -w -40 -safe-string -g -bin-annot -I src/lib/netkat/.frenetic_netkat.objs -I /home/ty/.opam/4.06.0/lib/base -I /home/ty/.opam/4.06.0/lib/base/caml -I /home/ty/.opam/4.06.0/lib/base/md5 -I /home/ty/.opam/4.06.0/lib/base/shadow_stdlib -I /home/ty/.opam/4.06.0/lib/base64 -I /home/ty/.opam/4.06.0/lib/bin_prot -I /home/ty/.opam/4.06.0/lib/bin_prot/shape -I /home/ty/.opam/4.06.0/lib/bytes -I /home/ty/.opam/4.06.0/lib/core -I /home/ty/.opam/4.06.0/lib/core_kernel -I /home/ty/.opam/4.06.0/lib/core_kernel/base_for_tests -I /home/ty/.opam/4.06.0/lib/cstruct -I /home/ty/.opam/4.06.0/lib/fieldslib -I /home/ty/.opam/4.06.0/lib/gen -I /home/ty/.opam/4.06.0/lib/ipaddr -I /home/ty/.opam/4.06.0/lib/jane-street-headers -I /home/ty/.opam/4.06.0/lib/macaddr -I /home/ty/.opam/4.06.0/lib/menhirLib -I /home/ty/.opam/4.06.0/lib/ocaml-migrate-parsetree -I /home/ty/.opam/4.06.0/lib/ocaml/compiler-libs -I /home/ty/.opam/4.06.0/lib/ocaml/threads -I /home/ty/.opam/4.06.0/lib/ocamlgraph -I /home/ty/.opam/4.06.0/lib/ocplib-endian -I /home/ty/.opam/4.06.0/lib/ocplib-endian/bigstring -I /home/ty/.opam/4.06.0/lib/parsexp -I /home/ty/.opam/4.06.0/lib/ppx_assert/runtime-lib -I /home/ty/.opam/4.06.0/lib/ppx_bench/runtime-lib -I /home/ty/.opam/4.06.0/lib/ppx_compare/runtime-lib -I /home/ty/.opam/4.06.0/lib/ppx_derivers -I /home/ty/.opam/4.06.0/lib/ppx_deriving/runtime -I /home/ty/.opam/4.06.0/lib/ppx_expect/collector -I /home/ty/.opam/4.06.0/lib/ppx_expect/common -I /home/ty/.opam/4.06.0/lib/ppx_expect/config -I /home/ty/.opam/4.06.0/lib/ppx_hash/runtime-lib -I /home/ty/.opam/4.06.0/lib/ppx_inline_test/config -I /home/ty/.opam/4.06.0/lib/ppx_inline_test/runtime-lib -I /home/ty/.opam/4.06.0/lib/ppx_sexp_conv/runtime-lib -I /home/ty/.opam/4.06.0/lib/ppx_tools_versioned -I /home/ty/.opam/4.06.0/lib/result -I /home/ty/.opam/4.06.0/lib/sedlex -I /home/ty/.opam/4.06.0/lib/seq -I /home/ty/.opam/4.06.0/lib/sexplib -I /home/ty/.opam/4.06.0/lib/sexplib/unix -I /home/ty/.opam/4.06.0/lib/sexplib0 -I /home/ty/.opam/4.06.0/lib/spawn -I /home/ty/.opam/4.06.0/lib/splittable_random -I /home/ty/.opam/4.06.0/lib/stdio -I /home/ty/.opam/4.06.0/lib/stdlib-shims -I /home/ty/.opam/4.06.0/lib/tcpip -I /home/ty/.opam/4.06.0/lib/tcpip/unix -I /home/ty/.opam/4.06.0/lib/typerep -I /home/ty/.opam/4.06.0/lib/variantslib -I /home/ty/.opam/4.06.0/lib/yojson -I src/lib/kernel/.frenetic_kernel.objs -no-alias-deps -open Frenetic_netkat -o src/lib/netkat/.frenetic_netkat.objs/frenetic_netkat__Json.cmi -c -intf src/lib/netkat/Json.pp.mli)
- File "src/lib/netkat/Json.mli", line 18, characters 18-22:
- Error: Unbound type constructor json
[ERROR] The compilation of frenetic failed at "/home/ty/.opam/opam-init/hooks/sandbox.sh build jbuilder build -p frenetic -j 95".

#=== ERROR while compiling frenetic.5.0.3 =====================================#
# context     2.0.5 | linux/x86_64 | ocaml-base-compiler.4.06.0 | https://opam.ocaml.org#3da0e294
# path        ~/.opam/4.06.0/.opam-switch/build/frenetic.5.0.3
# command     ~/.opam/opam-init/hooks/sandbox.sh build jbuilder build -p frenetic -j 95
# exit-code   1
# env-file    ~/.opam/log/frenetic-1038312-d2c37b.env
# output-file ~/.opam/log/frenetic-1038312-d2c37b.out
### output ###
# File "src/lib/async/jbuild", line 17, characters 5-15:
# Error: Library "mparser.re" not found.
# Hint: try: jbuilder external-lib-deps --missing -p frenetic @install
#       ocamlc src/lib/netkat/.frenetic_netkat.objs/frenetic_netkat__Json.{cmi,cmti} (exit 2)
# (cd _build/default && /home/ty/.opam/4.06.0/bin/ocamlc.opt -w -40 -safe-string -g -bin-annot -I src/lib/netkat/.frenetic_netkat.objs -I /home/ty/.opam/4.06.0/lib/base -I /home/ty/.opam/4.06.0/lib/base/caml -I /home/ty/.opam/4.06.0/lib/base/md5 -I /home/ty/.opam/4.06.0/lib/base/shadow_stdlib -I /home/ty/.opam/4.06.0/lib/base64 -I /home/ty/.opam/4.06.0/lib/bin_prot -I /home/ty/.opam/4.06.0/lib/[...]
# File "src/lib/netkat/Json.mli", line 18, characters 18-22:
# Error: Unbound type constructor json

<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build frenetic 5.0.3
└─
╶─ No changes have been performed
'opam install frenetic' failed.
jnfoster commented 1 year ago

It looks like you are on OCaml 4.06. Please try on OCaml 4.12 or higher.

tylovehhx commented 1 year ago

Thanks for your quick reply!

Yes, I'm on OCaml 4.06. I use this version because I'm trying to install YATES (which is also developed by your team?). And it is said in the tutorial that I should use OCaml 4.06.

And when installing YATES, I run into the error:

opam pin add --yes --no-action yates .
[NOTE] Package yates is already pinned to git+file:///home/ty/ty/yates#master (version 1.0.0).
[yates.1.0.0] no changes from git+file:///home/ty/ty/yates#master
[WARNING] Failed checks on yates package definition from source at git+file:///home/ty/ty/yates#master:
    error 57: Synopsis and description must not be both empty
yates is now pinned to git+file:///home/ty/ty/yates#master (version 1.0.0)

So I decide to install the dependencies manually, and run into error when installing frenetic.

Is their any way to fix any of the error?

jnfoster commented 1 year ago

For the Frenetic errors, you could try to opam install the missing libraries. In principle, it should work. For the mparser issue, I think you need the OCaml ocaml-re library to be installed.

For the Yates errors, can you try building from source with the supplied Makefile?

tylovehhx commented 1 year ago

I got an error: (But I do have package mparser-re and re installed. Does it help? )

opam install ocaml-re
[ERROR] No package named ocaml-re found.
jnfoster commented 1 year ago

Sorry, seems like the GitHub repo and OPAM package have different names. Try opam install re.

tylovehhx commented 1 year ago

Thanks a lot for your help.

I downgraded the pacakge mparser-re and re, now the Error: Library "mparser.re" not found is gone. It seems that the version I installed is to high.

But there is still Error: Unbound type constructor json

The whole message are:

opam install frenetic
The following actions will be performed:
  ∗ install frenetic 5.0.3

<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[frenetic.5.0.3] found in cache

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[ERROR] The compilation of frenetic failed at "/home/ty/.opam/opam-init/hooks/sandbox.sh build jbuilder build -p frenetic -j 95".

#=== ERROR while compiling frenetic.5.0.3 =====================================#
# context     2.0.5 | linux/x86_64 | ocaml-base-compiler.4.06.0 | https://opam.ocaml.org#3da0e294
# path        ~/.opam/4.06.0/.opam-switch/build/frenetic.5.0.3
# command     ~/.opam/opam-init/hooks/sandbox.sh build jbuilder build -p frenetic -j 95
# exit-code   1
# env-file    ~/.opam/log/frenetic-1422727-d2c37b.env
# output-file ~/.opam/log/frenetic-1422727-d2c37b.out
### output ###
#       ocamlc src/lib/netkat/.frenetic_netkat.objs/frenetic_netkat__Json.{cmi,cmti} (exit 2)
# (cd _build/default && /home/ty/.opam/4.06.0/bin/ocamlc.opt -w -40 -safe-string -g -bin-annot -I src/lib/netkat/.frenetic_netkat.objs -I /home/ty/.opam/4.06.0/lib/base -I /home/ty/.opam/4.06.0/lib/base/caml -I /home/ty/.opam/4.06.0/lib/base/md5 -I /home/ty/.opam/4.06.0/lib/base/shadow_stdlib -I /home/ty/.opam/4.06.0/lib/base64 -I /home/ty/.opam/4.06.0/lib/bin_prot -I /home/ty/.opam/4.06.0/lib/[...]
# File "src/lib/netkat/Json.mli", line 18, characters 18-22:
# Error: Unbound type constructor json

<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build frenetic 5.0.3
└─
╶─ No changes have been performed

Is there any way to fix it? Maybe still because some packages is too up-to-date?

jnfoster commented 1 year ago

I'm confused. That type is defined a few lines above in the code. https://github.com/frenetic-lang/frenetic/blob/master/src/lib/netkat/Json.mli#L15

Would you be willing to try building Frenetic from source instead of OPAM? Then we could eliminate the possible mismatch between the code you got from the package repository vs. Github.

tylovehhx commented 1 year ago

Yea, I'd like to try. So how can I building Frenetic from source T_T

jnfoster commented 1 year ago

Clone this repository. There is a Makefile in it. Typing make from within the frenetic directory works for me on my local environment.

tylovehhx commented 1 year ago

After typing make, I got the error Error: Library "tcpip.checksum" not found.

Which package should I install (or how can I find the corresponding package name in Internet instead of borthering you? I googled it but found nothing useful)

jnfoster commented 1 year ago

In general, keep running opam install <packagename> when you get errors like this.

jnfoster commented 1 year ago

The packages (and versions) listed here https://github.com/frenetic-lang/frenetic/blob/master/frenetic.opam may be helpful.

tylovehhx commented 1 year ago

OK, I found out that it's because the version of the tcpip package I installed is not correct and fixed it.

But new error come up:

 make
time -p dune build @install
File "src/lib/netkat/Generated_Parser.ml", lines 1442-1552, characters 4-15:
1442 | ....match _tok with
1443 |     | Lexer.ABSTRACTLOC ->
1444 |         "ABSTRACTLOC"
1445 |     | Lexer.AND ->
1446 |         "AND"
...
1549 |     | Lexer.VSWITCH ->
1550 |         "VSWITCH"
1551 |     | Lexer.WHILE ->
1552 |         "WHILE"
Error (warning 8 [partial-match]): this pattern-matching is not exhaustive.
Here is an example of a case that is not matched:
(IVERSON _|ANTIQ _)
File "src/lib/netkat/Portless_Generated_Parser.ml", lines 1442-1552, characters 4-15:
1442 | ....match _tok with
1443 |     | Lexer.ABSTRACTLOC ->
1444 |         "ABSTRACTLOC"
1445 |     | Lexer.AND ->
1446 |         "AND"
...
1549 |     | Lexer.VSWITCH ->
1550 |         "VSWITCH"
1551 |     | Lexer.WHILE ->
1552 |         "WHILE"
Error (warning 8 [partial-match]): this pattern-matching is not exhaustive.
Here is an example of a case that is not matched:
(IVERSON _|ANTIQ _)
Command exited with non-zero status 1
real 0.82
user 1.81
sys 0.24
make: *** [Makefile:4: build] Error 1

Really really thanks for your time and patience.

tylovehhx commented 1 year ago

update:

I've fixed the issue Error: Unbound type constructor json This error occurs because the yojson package version is too high. Originally my yojson version is 2.0.2. I downgraded it to 1.7.0 (according to https://github.com/frenetic-lang/frenetic/blob/master/frenetic.opam). Then the error is fixed.

Overall, all issues come up because of package version dismatch.

Now I successfully instaled frenetic.5.0.3 on OCaml 4.06. After that, I also successfully installed YATES.

Again, I'd like to thank for the kindly help from Nate Foster.

jnfoster commented 1 year ago

Glad to hear it! We will bump our OPAM files so automated installation is better supported.