1

我在 6 个月前安装了 merlin,以便能够编译 Ocaml,我没有遇到任何问题。我最近升级以更新所有内容,但无法使软件包正常工作。

当我尝试重新安装它时,我收到此错误消息(opam install -y merlin):

[coq-released] synchronised from https://coq.inria.fr/opam/released
[default] no changes from https://opam.ocaml.org
The following actions will be performed:
  ∗ install ocaml-base-compiler 4.12.0  [required by ocaml]
  ∗ install ocaml-config        2       [required by ocaml]
  ∗ install ocaml               4.12.0  [required by merlin]
  ∗ install ocamlfind           1.9.3   [required by dot-merlin-reader]
  ∗ install dune                2.9.3   [required by merlin]
  ∗ install result              1.5     [required by merlin]
  ∗ install easy-format         1.3.2   [required by yojson]
  ∗ install csexp               1.5.1   [required by merlin]
  ∗ install cppo                1.6.8   [required by yojson]
  ∗ install biniou              1.2.1   [required by yojson]
  ∗ install yojson              1.7.0   [required by merlin]
  ∗ install dot-merlin-reader   4.1     [required by merlin]
  ∗ install merlin              4.4-412
===== ∗ 13 =====

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><>   
⬇ retrieved biniou.1.2.1  (cached)
⬇ retrieved csexp.1.5.1  (cached)
⬇ retrieved dot-merlin-reader.4.1  (cached)
⬇ retrieved cppo.1.6.8  (cached)
⬇ retrieved easy-format.1.3.2  (cached)
⬇ retrieved dune.2.9.3  (cached)
⬇ retrieved ocaml-base-compiler.4.12.0  (cached)
⬇ retrieved result.1.5  (cached)
⬇ retrieved ocamlfind.1.9.3  (cached)
⬇ retrieved yojson.1.7.0  (cached)
⬇ retrieved merlin.4.4-412  (cached)
[ERROR] The installation of ocaml-base-compiler failed at "make install".

#=== ERROR while installing ocaml-base-compiler.4.12.0 ========================#
# context     2.1.2 | macos/arm64 |  | https://opam.ocaml.org#71d8d30e
# path        ~/.opam/4.12.0/.opam-switch/build/ocaml-base-compiler.4.12.0
# command     ~/.opam/opam-init/hooks/sandbox.sh install make install
# exit-code   2
# env-file    ~/.opam/log/ocaml-base-compiler-11755-86d59b.env
# output-file ~/.opam/log/ocaml-base-compiler-11755-86d59b.out
### output ###
# if test -f ocamlnat ; then \
# [...]
#        "/Users/theosouchon/.opam/4.12.0/lib/ocaml"; \
#     /usr/bin/install -c -m 644 \
#        toplevel/opttopstart.cmx toplevel/opttopstart.o \
#        "/Users/theosouchon/.opam/4.12.0/lib/ocaml/compiler-libs"; \
#   fi
# cd "/Users/theosouchon/.opam/4.12.0/lib/ocaml/compiler-libs" && \
#      ranlib ocamlcommon.a ocamlbytecomp.a ocamloptcomp.a
# ranlib: error: exactly one archive should be specified
# make[2]: *** [installoptopt] Error 1
# make[1]: *** [installopt] Error 2
# make: *** [install] Error 2

如果您有解决此问题的想法,我很感兴趣

非常感谢你, 西奥 Souchon

4

1 回答 1

2

您遇到的问题与梅林本身无关。问题是您无法使用 llvm 工具链构建编译器,该工具链在您的机器上默认使用。

ranlib工具的 GNU 版本能够接受多个存档参数,不像 llvm 版本ranlib在多个存档上失败。

一般的答案是您应该安装并选择 GNU 工具链来构建 OCaml。我会从跑步开始我的调查,which ranlib以了解您为什么ranlib在 PATH 中出现故障。您也可能曾经brew安装过 llvm 工具链,然后使用它brew unlink来撤消此操作。最后,您希望ranlib在您的路径中为ranlib --versionprints GNU ranlib,而不是LLVM.

此外,在 macOS 中,有一个名为的工具xcode-select可让您安装和选择工具链。我没有可用的最新版本的 macOS,所以我不能确定,但​​您可以尝试运行xcode-select --install以安装工具链并使用xcode-select --switch来选择合适的工具链。

综上所述,OCamlopam问题跟踪器比 SO 是解决此类问题的好地方。

于 2022-02-15T15:59:57.500 回答