2015-01-21 86 views
5
$ ocaml -version 
The OCaml toplevel, version 4.02.1 
$ opam --version 
1.2.0 
$ opam init 
$ opam install core 

#=== ERROR while installing camlp4.4.02.1+system ==============================# 
# opam-version 1.2.0 
# os   linux 
# command  sh ./check-camlp4.sh 
# path   /home/john/.opam/system/build/camlp4.4.02.1+system 
# compiler  system (4.02.1) 
# exit-code 1 
# env-file  /home/john/.opam/system/build/camlp4.4.02.1+system/camlp4-32324-f0f09f.env 
# stdout-file /home/john/.opam/system/build/camlp4.4.02.1+system/camlp4-32324-f0f09f.out 
# stderr-file /home/john/.opam/system/build/camlp4.4.02.1+system/camlp4-32324-f0f09f.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 foun 

我回答了opam init期間的自動完成腳本問題。此外,錯誤的截斷部分提示如下:如何在(Arch)Linux x86_64上安裝OCaml Core庫?

請安裝系統範圍版本的camlp4。這是必需的 ,因爲您使用OCaml 4.02.1和系統編譯器開關(其中 使用您預先存在的安裝而不是從 暫時編譯一個)。

如果您不能安裝在系統範圍camlp4,那麼你仍然可以通過opam switch 4.02.1

# pacman -S camlp4 
$ opam install camlp4 
$ opam info camlp4 
      package: camlp4 
      version: 4.02.1+system 
     repository: default 
      homepage: https://github.com/ocaml/camlp4 
      license: LGPLv2 
    installed-version: 4.02.1+system [system] 

再次...

$ opam install core 

#=== ERROR while installing herelib.109.35.02 =================================# 
# opam-version 1.2.0 
# os   linux 
# command  make 
# path   /home/john/.opam/system/build/herelib.109.35.02 
# compiler  system (4.02.1) 
# exit-code 2 
# env-file  /home/john/.opam/system/build/herelib.109.35.02/herelib-31366-c61e7b.env 
# stdout-file /home/john/.opam/system/build/herelib.109.35.02/herelib-31366-c61e7b.out 
# stderr-file /home/john/.opam/system/build/herelib.109.35.02/herelib-31366-c61e7b.err 
### stdout ### 
# ...[truncated] 
# ocamlfind ocamlopt -shared -linkall lib/herelib.cmxa -o lib/herelib.cmxs 
# ocamlfind ocamldep -syntax camlp4o -package camlp4.extend -package camlp4.quotations -package camlp4.lib -modules lib/pa_here.mli > lib/pa_here.mli.depends 
# ocamlfind ocamlc -c -g -syntax camlp4o -package camlp4.extend -package camlp4.quotations -package camlp4.lib -I lib -o lib/pa_here.cmi lib/pa_here.mli 
# + ocamlfind ocamlc -c -g -syntax camlp4o -package camlp4.extend -package camlp4.quotations -package camlp4.lib -I lib -o lib/pa_here.cmi lib/pa_here.mli 
# File "lib/pa_here.mli", line 1: 
# Error: The files /usr/lib/ocaml/pervasives.cmi 
#  and /usr/lib/ocaml/camlp4/Camlp4.cmi make inconsistent assumptions 
#  over interface Pervasives 
# Command exited with code 2. 
# Makefile:21: recipe for target 'build' failed 
### stderr ### 
# File "setup.ml", line 232, characters 8-26: 
# Warning 3: deprecated: String.set 
# Use Bytes.set instead. 
# File "setup.ml", line 2385, characters 6-24: 
# Warning 3: deprecated: Lazy.lazy_from_fun 
# Use Lazy.from_fun instead. 
# E: Failure("Command ''/usr/bin/ocamlbuild' lib/herelib.cma lib/herelib.cmxa lib/herelib.a lib/herelib.cmxs lib/pa_herelib.cma lib/pa_herelib.cmxa lib/pa_here 
lib.a lib/pa_herelib.cmxs -use-ocamlfind -tag debug' terminated with error code 10") 
# make: *** [build] Error 1 
使用 OCaml的 4.02切換到本地安裝

我需要切換到不同的編譯器嗎?

$ opam switch 
system C system System compiler (4.02.1) 
--  -- 3.11.2 Official 3.11.2 release 
--  -- 3.12.1 Official 3.12.1 release 
--  -- 4.00.0 Official 4.00.0 release 
--  -- 4.00.1 Official 4.00.1 release 
--  -- 4.01.0 Official 4.01.0 release 
--  -- 4.02.0 Official 4.02.0 release 
--  -- 4.02.1 Official 4.02.1 release 

回答

5

您應該從系統編譯器切換到OPAM的系統編譯器。然後,編譯器的源代碼將被自動下載和編譯以及所有先決條件。爲了切換,請使用以下命令:

opam switch 4.02.1 

相反的4.02.1你可以使用過程中的任何可用的編譯器。

實際的錯誤是,由於某種原因(我認爲是由於滾動發佈模式),您有不同版本的camlp4和OCaml編譯器,因此它們無法相互通信。

+0

我注意到camlp4軟件包是孤立的,這是不幸的,因爲它在官方存儲庫中。 – metabind 2015-01-21 05:26:24

+0

camlp4正在被棄用,因爲它被ppx所取代。 – nlucaroni 2015-01-21 17:57:41

+0

它不被棄用,並且不會被ppx取代。 ppx和camlp4有一些交叉點,但它們是完全不同的工具。 – ivg 2015-01-22 00:18:36