在OS X 10.9上使用opam安装camlp4失败

时间:2015-04-20 11:46:07

标签: macos ocaml opam

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

Fresh意味着没有.opam目录 我运行opam init 然后opam安装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

1 个答案:

答案 0 :(得分:4)

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

 sudo port install ocaml-camlp4

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

 opam switch 4.02.1
 eval `opam config env`

然后一切都将成为一种魅力。