Hi, new to ocaml here, trying to install a newer version on Ubuntu 18 as a needed dependency.
I downloaded the 4.12.0 version from here Releases – OCaml and followed the INSTALL.adoc
steps.
./configure
make
make tests
make step complained about module Pervasives not found (which I can see at /usr/lib/ocaml/
) so probably that’s fine. But the make tests
step return immediately with this error:
ocaml-4.12.0> make tests
make -C testsuite all
make[1]: Entering directory '/home/david/Downloads/ocaml-4.12.0/testsuite'
Makefile:122: *** ocamltest not found in ../ocamltest. Stop.
Makefile:116: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/david/Downloads/ocaml-4.12.0/testsuite'
Makefile:569: recipe for target 'tests' failed
make: *** [tests] Error 2
What am I doing wrong?
It sounds like the real error is at the make
step. What is the error message related to Pervasives
?
I believe that ocamltest
isn’t built by default on released versions. You should pass the --enable-ocamltest
flag to configure when you want to run the tests from a release tarball.
(The Pervasives
issue could also indicate another problem; if possible please show the exact message you got).
2 Likes
Unless you specifically need to compile from source for some reason, you should use opam to install OCaml. Follow the instructions at Up and Running with OCaml – OCaml
1 Like
opam
needs internet access (I think), which I lack (air-gapped computer).
Thanks vlaviron, that was the answer to the missing ocamltest! The next question is where everything is installed after the naked ./configure && make
.
After make, a ocaml
binary resides in the current folder (ocaml-4.12.0
), but running that results in:
ocaml-4.12.0> ./ocaml --version
-bash: ./ocaml: /usr/local/bin/ocamlrun: bad interpreter: No such file or directory
opam
should not need internet access.
I’m lacking a good howto to point to you and the following is very hand-wavy.
But basically you can do a local repo (maybe clone the official repo) and then cache the tarballs via opam admin cache
and copy that to your air gapped machine. Then make opam use that local repo for your switches.
1 Like
Nothing gets installed until you run make install
.
By default everything gets installed under the /usr/local
prefix. If you need to install in another location (for example if you don’t have write access to /usr/local
), you can add --prefix /my/installation/dir/
to the configure flags (you need to recompile everything whenever you change the prefix though).
There are some decent installations instructions in the INSTALL.adoc file that should be included in the release (they look a bit outdated but still more or less correct).
1 Like