syntax error when building ocamlbuild 0.12.0
I'm trying to install ocamlbuild through opam.
I get the following output:
$ opam install ocamlbuild
The following actions will be performed:
∗ install ocamlbuild 0.12.0
<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[ocamlbuild.0.12.0] found in cache
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[ERROR] The compilation of ocamlbuild failed at "/home/eugen/.opam/opam-init/hooks/sandbox.sh build make check-if-preinstalled all opam-install".
#=== ERROR while compiling ocamlbuild.0.12.0 ==================================#
# context 2.0.0~rc3 | linux/x86_64 | base-bigarray.base base-threads.base base-unix.base | https://opam.ocaml.org
# path ~/.opam/4.06.1/.opam-switch/build/ocamlbuild.0.12.0
# command ~/.opam/opam-init/hooks/sandbox.sh build make check-if-preinstalled all opam-install
# exit-code 2
# env-file ~/.opam/log/ocamlbuild-9258-5f1023.env
# output-file ~/.opam/log/ocamlbuild-9258-5f1023.out
### output ###
# [...]
# 4334 additional bytes used for bindings
# ocamlc -w L -w R -w Z -I src -I +unix -safe-string -bin-annot -c src/lexers.mli
# ocamlc -w L -w R -w Z -I src -I +unix -safe-string -bin-annot -c src/lexers.ml
# ocamlc -w L -w R -w Z -I src -I +unix -safe-string -bin-annot -c src/param_tags.mli
# ocamlc -w L -w R -w Z -I src -I +unix -safe-string -bin-annot -c src/param_tags.ml
# ocamlc -w L -w R -w Z -I src -I +unix -safe-string -bin-annot -c src/command.mli
# ocamlc -w L -w R -w Z -I src -I +unix -safe-string -bin-annot -c src/command.ml
# ocamlc -w L -w R -w Z -I src -I +unix -safe-string -bin-annot -c src/ocamlbuild_config.ml
# File "src/ocamlbuild_config.ml", line 10, characters 0-3:
# Error: Syntax error
# Makefile:422: recipe for target 'src/ocamlbuild_config.cmo' failed
# make: *** [src/ocamlbuild_config.cmo] Error 2
The culprit line looks like this:
let ocaml_native =
This is very strange -- many people can build ocamlbuild just fine. What is the OCaml version being used to build?
The OCaml version is 4.06.1, but this seems to be related to the opam packaging.
I've just solved this by running:
opam config set-global ocaml-native true
opam config set-global ocaml-native-tools true
It seems that in opam.2.0.0 these configuration variables are not set. Or at least on my machine they were not set for some reason...
OCamlbuild 0.14.0 is now out, and has been converted to opam2 -- the opam file in trunk has also been updated. Could you maybe try this new version?