Failde to compile : ocamlfind: Package `xmlm' not found

350 Views Asked by At

I am trying to compile an OCaml .ml file with make command via command line remote machine but it shows me this error:

+ ocamlfind ocamlc -c -package xmlm -package unix -o pms.cmo pms.ml
ocamlfind: Package `xmlm' not found
Command exited with code 2.
Hint: Recursive traversal of subdirectories was not enabled for this build,
  as the working directory does not look like an ocamlbuild project (no
  '_tags' or 'myocamlbuild.ml' file). If you have modules in subdirectories,
  you should add the option "-r" or create an empty '_tags' file.
  
  To enable recursive traversal for some subdirectories only, you can use the
  following '_tags' file:
  
      true: -traverse
      <dir1> or <dir2>: traverse
      
Compilation unsuccessful after building 6 targets (5 cached) in 00:00:00.
Makefile:10 : la recette pour la cible « native » a échouée
make: *** [native] Erreur 10

I tried to export the environment with this command:

eval $(/usr/bin/opam config env --root=/path/Ocaml/opam-ocaml-4.04-strech)

But also I had this error :

# opam-version    1.2.2
# os              linux
File /p/opas/src/Ocaml/opam-ocaml-4.04-strech/config does not exist

while the config file does exist in the directory

any help Please ?!! Thank you

1

There are 1 best solutions below

0
On

To make a package available via opam (assuming that opam is properly installed and configured) you need to:

  1. install the package
  2. activate your opam

To install a package named foo, execute the following command in your shell

opam install foo

To activate your opam installation (which enables the search paths), issue the following command

eval $(opam config env)

or, with modern opam (that is of version 2.x) just eval $(opam env)

Before doing this, you need to properly initialize your opam installation, i.e., to install the compiler (or use the system compiler) and the base packages. This is done via the opam init command that creates an opam-managed subdirectory in your home, e.g., using an (old by today's standards) OCaml version 4.04.0, you can initialize it like this

opam init --comp=4.04.0

once the initialization is finished, do not forget to activate it via eval $(opam config env) and now you can install the package.

Finally, the version of opam that you're using is outdated and long ago deprecated, thus it is not receiving updates and the repositories that this version can understand are frozen and no longer updated. You really need to update your opam to a 2.x version. Please follow the opam installation instructions to get the latest version.