Ocaml 安装核心库

Ocaml 安装核心库,ocaml,ocamlfind,Ocaml,Ocamlfind,我是ocaml的新手。我正在尝试使用OPAM 1.1.1安装core和utop,但我得到以下信息: mario@mario-VirtualBox:~$ opam install core The following actions will be performed: - install ocamlfind.1.4.0 [required by core] - install type_conv.111.13.00

我是ocaml的新手。我正在尝试使用OPAM 1.1.1安装core和utop,但我得到以下信息:

mario@mario-VirtualBox:~$ opam install core
The following actions will be performed:
 - install   ocamlfind.1.4.0                       [required by core]
 - install   type_conv.111.13.00                   [required variantslib,               pa_test,       pa_bench, enumerate, comparelib, bin_prot, custom_printf, fieldslib, pa_ounit, sexplib]
 - install   pipebang.110.01.00                    [required by core]
 - install   ounit.2.0.0                           [required by pa_ounit]
 - install   herelib.109.35.02                     [required by core]
 - install   variantslib.109.15.03                 [required by core]
 - install   sexplib.111.13.00                     [required by core]
 - install   fieldslib.109.20.03                   [required by core]
 - install   enumerate.111.08.00                   [required by core]
 - install   comparelib.109.60.00                  [required by core]
 - install   bin_prot.111.03.00                    [required by core]
 - install   pa_ounit.109.53.02                    [required by core]
 - install   pa_test.111.08.00                     [required by core]
 - install   typerep.111.06.00                     [required by core_kernel]
 - install   pa_bench.109.55.02                    [required by core]
 - install   custom_printf.111.03.00               [required by core]
 - install   core_kernel.111.13.00                 [required by core]
 - install   core.111.13.00
18 to install | 0 to reinstall | 0 to upgrade | 0 to downgrade | 0 to remove
Do you want to continue ? [Y/n] y

=-=-= Synchronizing package archives =-=-=

=-=-= Installing ocamlfind.1.4.0 =-=-=
Building ocamlfind.1.4.0:
  ./configure -bindir /home/mario/.opam/system/bin -sitelib /home/mario/.opam/system/lib -mandir /home/mario/.opam/system/man -config /home/mario/.opam/system/lib/findlib.conf -no-topfind
  make all
  make opt
  make install
[ERROR] The compilation of ocamlfind.1.4.0 failed.
Removing ocamlfind.1.4.0.
  Nothing to do.

[ERROR] Failure while processing ocamlfind.1.4.0


===== ERROR while installing ocamlfind.1.4.0 =====
# opam-version 1.1.1 (71b2a01ee571507c1819fbd282b0500d628f92d3)
# os           linux
# command      ./configure -bindir /home/mario/.opam/system/bin -sitelib /home/mario/.opam/system/lib -mandir /home/mario/.opam/system/man -config /home/mario/.opam/system/lib/findlib.conf -no-topfind
# path         /home/mario/.opam/system/build/ocamlfind.1.4.0
# compiler     system (4.01.0)
# exit-code    1
# env-file     /home/mario/.opam/system/build/ocamlfind.1.4.0/ocamlfind-2662-c743ac.env
# stdout-file  /home/mario/.opam/system/build/ocamlfind.1.4.0/ocamlfind-2662-c743ac.out
# stderr-file  /home/mario/.opam/system/build/ocamlfind.1.4.0/ocamlfind-2662-c743ac.err
### stdout ###
# Welcome to findlib version 1.4
# Configuring core...
### stderr ###
# configure: m4 not in PATH; this is required

可能是OPAM安装不正确吗?关于如何纠正此问题,请提供任何建议?

opam从源代码而不是预编译的二进制文件安装软件包。这意味着您需要安装所有建筑必备组件。opam将负责安装那些依赖于ocaml生态系统的工具,但系统工具和库应由用户手动安装

很难猜测您的设置是什么,但看起来您甚至还没有安装C编译器。通常,带有它的包名为
gcc
。如果您有一些debian或其派生版本,那么您可以尝试以root用户身份运行以下命令:
apt get install gcc

更新 为了获得一个安装了OCaml的功能齐全的linux,我建议使用一个专门为哈佛CS51课程准备的设备,该课程教授OCaml

首先,您应该安装一个设备,如下所示。然后登录到设备,找到终端应用程序并调用以下命令

curl -s http://sites.fas.harvard.edu/~cs51/setup51.sh | sh
这将下载并安装一个opam,并自动设置使用真实世界OCaml书籍中的示例所需的环境

如果出现问题,请随时提问。

这是一份副本


解决方案是
sudo apt get install m4

消息很清楚:您需要
m4
工具来完成
ocamlfind
的编译。由于它与ocaml无关,所以此工具的安装不是由
opam
负责的,您必须使用自己的分发包管理器(例如在类似Debian的系统上:
apt get install m4
)自行完成。感谢各位,这非常有帮助。请问,我在哪里可以了解apt get install等命令?我在Oracle虚拟机上使用Xubuntu,但对Linux知之甚少。有很多源代码可以学习Linux,但如果您对OCaml感兴趣,我建议使用预先安装了OCaml的专门准备的设备。我已经用详细的说明更新了这篇文章。似乎ivg读懂了我的心思。我完全是为了学习CS51而设置OCaml的(去年我学习了CS50,学到了很多)。谢谢,你帮了我很大的忙。