1

我在 Mac OS X 10.10 上用自制软件安装了 opam。但我无法使用 opam 安装任何东西。这是我尝试安装 ocamlfind 时得到的示例错误输出:

# opam-version 1.2.0
# os           darwin
# command      ./configure -bindir /Users/roger/.opam/system/bin -sitelib /Users/roger/.opam/system/lib -mandir /Users/roger/.opam/system/man -config /Users/roger/.opam/system/lib/findlib.conf -no-topfind
# path         /Users/roger/.opam/system/build/ocamlfind.1.5.5
# compiler     system (4.02.1)
# exit-code    1
# env-file     /Users/roger/.opam/system/build/ocamlfind.1.5.5/ocamlfind-91360-c61e7b.env
# stdout-file  /Users/roger/.opam/system/build/ocamlfind.1.5.5/ocamlfind-91360-c61e7b.out
# stderr-file  /Users/roger/.opam/system/build/ocamlfind.1.5.5/ocamlfind-91360-c61e7b.err
### stdout ###
# ...[truncated]
# Configuration for str written to site-lib-src/str/META
# Configuration for threads written to site-lib-src/threads/META
# Configuration for unix written to site-lib-src/unix/META
# Configuration for stdlib written to site-lib-src/stdlib/META
# Configuration for bigarray written to site-lib-src/bigarray/META
# Configuration for camlp4 written to site-lib-src/camlp4/META
# Configuration for ocamlbuild written to site-lib-src/ocamlbuild/META
# Configuration for compiler-libs written to site-lib-src/compiler-libs/META
# Configuration for bytes written to site-lib-src/bytes/META
# Detecting compiler arguments: FAILED (see the file ocargs.log for details)
### stderr ###
# ./configure: line 547: cd: src: No such file or directory
4

2 回答 2

2
brew install opam
opam init --comp=4.02.1
eval `opam config env`
ocaml

更新:

有时 brewed opam 可能会失败Illegal Instruction,在这种情况下,您需要从源重新安装 opam:

brew reinstall --build-from-source opam

此外,您还需要一个工作工具链,即编译器、自动工具和其他开发工具。您可以尝试使用brew,例如,brew install autotools等安装它。或者您可以尝试安装xcode工具链,包括苹果命令行开发人员工具。

于 2015-01-14T02:41:23.813 回答
1

我在尝试安装 mirage 时遇到了同样的问题,问题是因为在 macOS X 上默认情况下当前目录不在 CDPATH 中。posix /bin/sh 虽然可以“cd ./src”,但不会“cd src”。快速修复是在运行 opam 之前执行以下操作(或者只是将它放在您的 .bash_profile 中。

export CDPATH=. opam install WHATEVER

于 2017-02-26T05:37:24.677 回答