OCamlfind构建失败

时间:2015-02-28 23:18:28

标签: macos ocaml ocamlfind

当我尝试使用ocamlfind安装opam install ocamlfind时,编译失败并显示以下消息:

#=== ERROR while installing ocamlfind.1.5.5 ===================================#
# opam-version 1.2.0
# os           darwin
# command      make all
# path         /Users/MTGAP/.opam/system/build/ocamlfind.1.5.5
# compiler     system (4.02.1)
# exit-code    2
# env-file     /Users/MTGAP/.opam/system/build/ocamlfind.1.5.5/ocamlfind-21707-c61e7b.env
# stdout-file  /Users/MTGAP/.opam/system/build/ocamlfind.1.5.5/ocamlfind-21707-c61e7b.out
# stderr-file  /Users/MTGAP/.opam/system/build/ocamlfind.1.5.5/ocamlfind-21707-c61e7b.err
### stdout ###
# ...[truncated]
# ocamlc -I +compiler-libs -c fl_package_base.mli
# ocamlc -I +compiler-libs -g -c fl_package_base.ml
# ocamlc -I +compiler-libs -c findlib.mli
# ocamlc -I +compiler-libs -g -c findlib.ml
# ocamlc -I +compiler-libs -g -c fl_args.ml
# ocamlc -I +compiler-libs -a -o findlib.cma findlib_config.cmo fl_split.cmo fl_metatoken.cmo fl_meta.cmo fl_metascanner.cmo fl_topo.cmo fl_package_base.cmo findlib.cmo fl_args.cmo
# ocamlc -I +compiler-libs -g -c ocaml_args.ml
# ocamlc -I +compiler-libs -g -c frontend.ml
# ocamlc -I +compiler-libs -custom -o ocamlfind -g findlib.cma unix.cma \
#              ocaml_args.cmo frontend.cmo
### stderr ###
# ...[truncated]
# Undefined symbols for architecture x86_64:
#   "start", referenced from:
#      implicit entry/start for main executable
#      (maybe you meant: _caml_heap_start, _caml_young_start , _caml_start_code , _caml_startup_code )
# ld: symbol(s) not found for architecture x86_64
# clang: error: linker command failed with exit code 1 (use -v to see invocation)
# File "_none_", line 1:
# Error: Error while building custom runtime system
# make[1]: *** [ocamlfind] Error 2
     make: *** [all] Error 2

根据过去的Stack Overflow答案,如果没有安装m4,这个安装有时会失败,但我安装了m4并且在我的路径中,这样就不是问题了。

1 个答案:

答案 0 :(得分:1)

在您的系统或包管理器中看起来像是一个问题。首先,我建议不要使用系统编译器,而是从头开始安装新的编译器:

opam switch install 4.02.1
eval `opam config env`

如果这不起作用,请尝试查看您的编译器工具包,并确保链接器来自与编译器相同的工具包(最好是所有工具,应该链接到默认的OS X工具包)