0

I am new to ocaml. I am trying to install core and utop with OPAM 1.1.1 However I am getting the following:

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

Could it be that the OPAM installation is incorrect? Any suggestions about how I can correct the problem, please?

  • The message is clear: you need the `m4` tool in order to complete compilation of `ocamlfind`. As it is not ocaml related, the installation of this tool is not taken care of by `opam`, you have to do it by yourself, with your own distribution package manager (on Debian like system for instance: `apt-get install m4`). – didierc Jun 06 '14 at 18:58
  • possible duplicate of [error while installing ocamlfind.1.3.3 configure: m4 not in PATH; this is required](http://stackoverflow.com/questions/17912116/error-while-installing-ocamlfind-1-3-3-configure-m4-not-in-path-this-is-requir) – Thomash Jun 10 '14 at 09:37

2 Answers2

1

This is a duplicate of error while installing ocamlfind.1.3.3 configure: m4 not in PATH; this is required.

The solution is sudo apt-get install m4.

Community
  • 1
  • 1
Thomash
  • 6,339
  • 1
  • 30
  • 50
0

opam installs packages from sources, not from precompiled binaries. That means that you need to install all building prerequisites. opam will take care to install those that depends on ocaml ecosystem, but system tools and libraries should be installed manually by a user.

It is hard to guess what your setup is, but it looks like, that you even haven't installed a C compiler. Usually the package with it is named gcc. If you have some debian or its derivative, then you can try to run as root the following command: apt-get install gcc

Update

To get a fully functional linux with installed OCaml, I would suggest to use an appliance specially prepared for Harvard's CS51 course, that teaches OCaml.

At first you should install an appliance, following these instructions. Then login to the appliance, find out a Terminal application and invoke the following command

curl -s http://sites.fas.harvard.edu/~cs51/setup51.sh | sh

This will download and install an opam, and automagically setup the environment needed to work with examples from a Real World OCaml book.

Feel free to ask any questions if something goes wrong.

ivg
  • 34,431
  • 2
  • 35
  • 63
  • Thanks guys that was very helpful. Where can I learn about such commands as apt-get install, please? I am using Xubuntu on a Oracle VM, but know little about Linux. – Mario Xuereb Jun 07 '14 at 10:17
  • There're plenty of sources to learn Linux, but if you're interested in OCaml I'd suggest to use a specially prepared appliance with OCaml preinstalled. I've updated the post with detailed instructions. – ivg Jun 07 '14 at 17:32
  • It seems that ivg read my mind. I was setting up OCaml exactly so that I could follow CS51 (I followed CS50 last year and learned lots). Thanks, you have been very helpful. – Mario Xuereb Jun 11 '14 at 17:24