FrontC icon indicating copy to clipboard operation
FrontC copied to clipboard

Build fails due to syntax error on Set.Make(String)

Open jordr opened this issue 2 years ago • 5 comments

$ dune.build
File "frontc/cxml.ml", line 43, characters 19-20:
Error: Syntax error

This is because of this code bit: https://github.com/BinaryAnalysisPlatform/FrontC/blob/c95d785d9e440827d65a904544495194ad8a40a9/frontc/cxml.ml#L42-L59

jordr avatar Nov 21 '22 16:11 jordr

Note this also occurs when building from opam pin:

$ opam pin FrontC --dev-repo

[FrontC.3.4.3-1] synchronised (git+https://github.com/BinaryAnalysisPlatform/FrontC)
FrontC is now pinned to git+https://github.com/BinaryAnalysisPlatform/FrontC (version 4.1.0)

The following actions will be performed:
  ↗ upgrade FrontC 3.4.3-1 to 4.1.0*
Do you want to continue? [Y/n] Y

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Processing  2/4: [FrontC: dune build]
[ERROR] The compilation of FrontC.4.1.0 failed at "dune build -p FrontC -j 4 @install".

#=== ERROR while compiling FrontC.4.1.0 =======================================#
# context     2.1.3 | linux/x86_64 | base-unix.base | pinned(git+https://github.com/BinaryAnalysisPlatform/FrontC#c95d785d)
# path        ~/.opam/system/.opam-switch/build/FrontC.4.1.0
# command     ~/.opam/opam-init/hooks/sandbox.sh build dune build -p FrontC -j 4 @install
# exit-code   1
# env-file    ~/.opam/log/FrontC-6095-7c6cd2.env
# output-file ~/.opam/log/FrontC-6095-7c6cd2.out
### output ###
# (cd _build/default && /usr/bin/ocamldep.opt -modules -impl frontc/cxml.ml) > _build/default/frontc/.FrontC.objs/cxml.ml.d
# File "frontc/cxml.ml", line 43, characters 19-20:
# Error: Syntax error
# (cd _build/default && /usr/bin/ocamlc.opt -w -40 -g -bin-annot -I frontc/.FrontC.objs/byte -intf-suffix .ml -no-alias-deps -o frontc/.FrontC.objs/byte/cparser.cmo -c -impl frontc/cparser.ml)
# File "frontc/cparser.mly", line 4, characters 14-19:
# Error: Multiple definition of the extension constructor name Error.
#        Names must be unique in a given structure or signature.
# (cd _build/default && /usr/bin/ocamlopt.opt -w -40 -g -I frontc/.FrontC.objs/byte -I frontc/.FrontC.objs/native -intf-suffix .ml -no-alias-deps -o frontc/.FrontC.objs/native/cparser.cmx -c -impl frontc/cparser.ml)
# File "frontc/cparser.mly", line 4, characters 14-19:
# Error: Multiple definition of the extension constructor name Error.
#        Names must be unique in a given structure or signature.



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build FrontC 4.1.0
└─ 

jordr avatar Nov 21 '22 16:11 jordr

I presume you're using a very old version of theOCaml compiler. We support 4.08 and upward, what is your version? Alternatively, it could be a very new version that is not yet in our CI. Anyways, what version of OCaml are you building with?

ivg avatar Nov 23 '22 08:11 ivg

I am building with ocaml 4.04. I have upgraded to ocaml 4.07, the newest available using opam. I still get the error. This doesn't look like a version issue.

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Processing  2/4: [FrontC: dune build]
[ERROR] The compilation of FrontC.4.1.0 failed at "dune build -p FrontC -j 4 @install".

#=== ERROR while compiling FrontC.4.1.0 =======================================#
# context     2.1.3 | linux/x86_64 | base-unix.base | pinned(git+https://github.com/BinaryAnalysisPlatform/FrontC#c95d785d)
# path        ~/.opam/system/.opam-switch/build/FrontC.4.1.0
# command     ~/.opam/opam-init/hooks/sandbox.sh build dune build -p FrontC -j 4 @install
# exit-code   1
# env-file    ~/.opam/log/FrontC-15282-3ac299.env
# output-file ~/.opam/log/FrontC-15282-3ac299.out
### output ###
# (cd _build/default && /home/jruiz/.opam/system/bin/ocamldep.opt -modules -impl frontc/cxml.ml) > _build/default/frontc/.FrontC.objs/cxml.ml.d
# File "frontc/cxml.ml", line 43, characters 19-20:
# Error: Syntax error
# (cd _build/default && /home/jruiz/.opam/system/bin/ocamlc.opt -w -40 -g -bin-annot -I frontc/.FrontC.objs/byte -intf-suffix .ml -no-alias-deps -o frontc/.FrontC.objs/byte/cparser.cmo -c -impl frontc/cparser.ml)
# File "frontc/cparser.mly", line 4, characters 14-19:
# Error: Multiple definition of the extension constructor name Error.
#        Names must be unique in a given structure or signature.
# (cd _build/default && /home/jruiz/.opam/system/bin/ocamlopt.opt -w -40 -g -I frontc/.FrontC.objs/byte -I frontc/.FrontC.objs/native -intf-suffix .ml -no-alias-deps -o frontc/.FrontC.objs/native/cparser.cmx -c -impl frontc/cparser.ml)
# File "frontc/cparser.mly", line 4, characters 14-19:
# Error: Multiple definition of the extension constructor name Error.
#        Names must be unique in a given structure or signature.

By the way, if it really is a version issue this could be specified in the opam config with a FrontC → ocaml >= 4.08.0. At the moment it only says "depends ocaml" :

❯ opam show FrontC

<><> FrontC: information on all versions ><><><><><><><><><><><><><><><><><><><>
name                   FrontC
all-installed-versions 3.4.3-1 [system]
all-versions           3.4  3.4.1  3.4.2  3.4.3  3.4.3-1  4.0.0  4.1.0

<><> Version-specific details <><><><><><><><><><><><><><><><><><><><><><><><><>
version      3.4.3-1
repository   default
url.src      "https://github.com/BinaryAnalysisPlatform/FrontC/archive/refs/tags/v3.4.3.tar.gz"
url.checksum "md5=399f66735541ecf8e06220618eef5c98"
homepage     "https://github.com/BinaryAnalysisPlatform/FrontC"
bug-reports  "https://github.com/BinaryAnalysisPlatform/FrontC/issues"
dev-repo     "git+https://github.com/BinaryAnalysisPlatform/FrontC"
authors      "Hugues Cassé <[email protected]>"
maintainer   "Ivan Gotovchits <[email protected]>"
license      "LGPL-2.1-only"
depends      "ocaml"
synopsis     Library providing a C parser and lexer
description  FrontC is an OCAML library providing a C parser and lexer. The result
             is a syntactic tree easy to process with usual OCAML tree management.
             It provides support for ANSI C syntax, old-C K&R style syntax and the
             standard GNU CC attributes.
             It provides also a C pretty printer as an example of use.

jordr avatar Nov 25 '22 14:11 jordr

I am building with ocaml 4.04. I have upgraded to ocaml 4.07, the newest available using opam. I still get the error. This doesn't look like a version issue.

Well, it is, we only support 4.08.1 and above. And you're right, we should update the meta information in opam-repository to reflect it.

ivg avatar Nov 28 '22 14:11 ivg

In fact, it is already correctly specified. Your opam show FrontC printed the constraint for the old 3.4-2-1 version, which is successfully installed on your system switch.

I have upgraded to ocaml 4.07, the newest available using opam

The newest version of OCaml is 4.13.1. The 4.07 version is four years old. Try doing opam update to get your opam installation up to date. Also, make sure that you're using opam 2.x not opam 1.x, which is no longer supported or updated (so you could stuck in the old version of opam-repository)

ivg avatar Nov 28 '22 15:11 ivg