2

我不明白为什么在全新的 opam 安装上安装失败。

新鲜意味着没有 .opam 目录我运行 opam init 然后 opam install ocamlfind,它工作

其次是 opam install camlp4,但失败了。

怎么了?

$ opam install camlp4
The following actions will be performed:
 - install   camlp4.4.02.1+system
=== + 1 ===

=-=- Synchronizing package archives -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=   

=-=- Installing packages =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=   
Copying ~/.opam/repo/default/packages/camlp4/camlp4.4.02.1+system/files/install to ~/.opam/system/build/camlp4.4.02.1+system/
Copying ~/.opam/repo/default/packages/camlp4/camlp4.4.02.1+system/files/check-camlp4.sh to ~/.opam/system/build/camlp4.4.02.1+system/
Building camlp4.4.02.1+system:
  sh ./check-camlp4.sh
[ERROR] The compilation of camlp4.4.02.1+system failed.
Removing camlp4.4.02.1+system.
  Nothing to do.


#=== ERROR while installing camlp4.4.02.1+system ==============================#
# opam-version 1.2.0
# os           darwin
# command      sh ./check-camlp4.sh
# path         $home/.opam/system/build/camlp4.4.02.1+system
# compiler     system (4.02.1)
# exit-code    1
# env-file     $home/.opam/system/build/camlp4.4.02.1+system/camlp4-94259-58c514.env
# stdout-file   $home/.opam/system/build/camlp4.4.02.1+system/camlp4-94259-58c514.out
# stderr-file  $home/.opam/system/build/camlp4.4.02.1+system/camlp4-94259-58c514.err
### stdout ###
# ...[truncated]
# 4.02 by switching to a local installation via `opam switch 4.02.1`.
# 
# Here are some installation instructions for camlp4 if you obtained OCaml
# via the OPAM binary packages:
# 
# http://software.opensuse.org/download.html?project=home%3Aocaml&package=ocaml
# 
# * Debian/Ubuntu: sudo apt-get install camlp4-extra
# * RHEL/CentOS/Fedora: sudo yum install ocaml-camlp4
# 
### stderr ###
# ./check-camlp4.sh: line 3: camlp4orf: command not found
4

1 回答 1

5

实际上答案已经包含在 OPAM 输出中。澄清一下,您正在使用系统编译器,即已经安装在您的操作系统上的编译器(使用 macports 或 brew)。这意味着,camlp4 实际上是编译器的一部分,也需要从系统安装。因此,您需要使用包管理器安装它,例如,

 sudo port install ocaml-camlp4

或者只是切换到本地安装(推荐的方式)。这将要求您创建一个新的编译器安装,

 opam switch 4.02.1
 eval `opam config env`

之后,一切都会成为一种魅力。

于 2015-04-20T12:26:01.997 回答