Divers

Installer utop sur Mageia 6

Cet article a été mis à jour, vous consultez ici une archive de cet article!
Dernière mise à jour : 31/08/2017 à 23h27
Table des matières

Installer utop sur Mageia 6




Introduction



utop est un interpréteur ( un toplevel ; utop c'est Universal Toplevel ) pour le langage de programmation OCaml qu'on peut lancer dans un terminal.
ocaml est l’interpréteur par défaut, mais malheureusement il est franchement sommaire.
[bgcolor=#000000]
$ ocaml
OCaml version 4.02.3

# 5+6;;
- : int = 11
# 45 + 8;;
- : int = 53
# ^[[A
Voilà ce qu'on obtient, dernière ligne, en essayant de rappeler la commande précédente avec la touche <↑>.

utop est plus souple , et plus coloré.
!! Capture !!


Installation



utop est dans les dépôts


Mais ça ne fonctionne pas.
Le bug est déclaré, mais il n'y a plus de mainteneur, actuellement, pour les rpm OCaml.


Installation sans les dépôts


Voici une méthode non exclusive d'une autre a priori. Je présente ici un tutoriel issu d'une démarche empirique.
D'autres démarches peuvent fonctionner ou pas.
Pour résumer voici comment j'ai obtenu utop sous mageia 6.


Installer opam

opam est un gestionnaire de paquets pour OCaml, comme l'est pip (ou pip3) pour python (pour python 3).
Pas de problèmes, il est dans les rpm Mageia 6. Donc
Code BASH :
# urpmi opam

Il faut ensuite le paramètrer (commande, et messages) :
$ opam init
OPAM has already been initialized.
In normal operation, OPAM only alters files within ~/.opam.
During this initialisation, you can allow OPAM to add information to two
other files for best results. You can also make these additions manually
if you wish.
If you agree, OPAM will modify:
- ~/.bash_profile (or a file you specify) to set the right environment
variables and to load the auto-completion scripts for your shell (bash)
on startup. Specifically, it checks for and appends the following line:
. /home/dom/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true
- ~/.ocamlinit to ensure that non-system installations of `ocamlfind`
(i.e. those installed by OPAM) will work correctly when running the
OCaml toplevel. It does this by adding $OCAML_TOPLEVEL_PATH to the list
of include directories.
If you choose to not configure your system now, you can either configure
OPAM manually (instructions will be displayed) or launch the automatic setup
later by running:
opam config setup -a
Do you want OPAM to modify ~/.bash_profile and ~/.ocamlinit?
(default is 'no', use 'f' to name a file other than ~/.bash_profile)
[N/y/f]

Choisissez Yes.
Installer utop via opam

On doit pouvoir installer utop à l'aide d'opam.
Code BASH :
opam install utop

Mais, ça n'a pas fonctionné pour moi. J'ai l'erreur
Code BASH :
[ERROR] The compilation of ocamlfind failed at "make all".

Une erreur sur ocamlfind très connue de Google.


Autre démarche

J'ai contourné le problème ci dessus avec
Code BASH :
opam switch install 4.02.1





Confession



Je n'ai pas recherché les causes des différents bugs.
Et je confesse que je ne vous propose aucune explication ou solution aux bugs rencontrés.


Webographie




Meuz, le 31/08/17