For example, you installed OCaml 4.x.x compiler/environment via opam switch
and tried to install graphics
.
opam switch 4.x.x
# `opam switch create 4.x.x` if opam 2.0.0
eval `opam config env`
opam install graphics
You might encounter some errors like this.
# File "_none_", line 1:
# Error: Cannot find file graphics.cma
=-=- graphics.1.0 troubleshooting -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
=> This package checks whether the Graphics library was compiled.
The cause of this error is that the system lacks Graphics
library as described in the error messages.
To solve this problem, you have to install OpenGL libraries before you switch the environment.
There is no Graphics
library compiled if you haven't installed OpenGL libraries when you switched the environment.
As of 2018-06-02 and under the environment described below,
- Fedora 28
- System Compiler: OCaml 4.06.0 (Fedora Official Package)
- Opam 2.0.0 beta6 (Fedora Official Package)
- Switch: OCaml 4.06.1
- Remove the switch.
- Install OpenGL libraries (In my case
sudo dnf install glew-devel
worked) - Create a switch
- Install
Graphics
Here's what I typed.
opam switch remove 4.06.1
sudo dnf install glew-devel
opam switch create 4.06.1
opam $(opam env)
opam install graphics