加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

如何在(Arch)Linux x86_64上安装OCaml核心库?

发布时间:2020-12-14 01:02:07 所属栏目:Linux 来源:网络整理
导读:$ocaml -versionThe OCaml toplevel,version 4.02.1$opam --version1.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#
$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期间对自动完成脚本问题的回答是肯定的.此外,错误的截断部分表明以下内容:

Please install a system-wide version of camlp4. This is necessary
since you are using OCaml 4.02.1 and the system compiler switch (which
uses your preexisting installation rather than compile one from
scratch).

If you cannot install a system-wide camlp4,then you can still use
OCaml
4.02 by switching to a local installation via 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

我是否需要切换到其他编译器?

$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

解决方法

您应该从系统编译器切换到OPAM的编译器.然后将自动下载和编译编译器的源代码以及所有先决条件.要切换,请使用以下命令:

opam switch 4.02.1

当然,您可以使用任何可用的编译器而不是4.02.1.

实际的错误是由于某种原因(我认为由于滚动发布模型)你有不同版本的camlp4和OCaml编译器,所以他们不能互相交谈.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读