Ocamlfind command not found

Bard117 picture Bard117 · Jun 1, 2015 · Viewed 11.4k times · Source

I'm running into an issue installing a package that's reliant on ocamlfind but I'm getting an ocamlfind: command not found error when making.

I have installed ocamlfind with the ocaml package manager and have tried reinstalling using "opam reinstall ocamlfind".

I have also tried the 'eval opam config env' command to see if updates my bin.

Has anyone run into a similar issue/know what this might be caused by

The output when running the make:

make
ocamlfind ocamlc -pp "camlp4o -I lib/dcg -I lib/ipp pa_dcg.cmo pa_ipp.cmo" -w usy -thread -I lib -I lib/dcg -I lib/ipp       -c semantics.ml
/bin/sh: ocamlfind: command not found

The output when trying ocamlfind

ocamlfind
-bash: ocamlfind: command not found

ocaml is installed

opam install ocamlfind
[NOTE] Package ocamlfind is already installed (current version is 1.5.5).

and when running the eval command

eval 'opam config env'
CAML_LD_LIBRARY_PATH="/home/centos/.opam/system/lib/stublibs:/usr/lib64/ocaml/stub libs"; export CAML_LD_LIBRARY_PATH;
MANPATH="/home/centos/.opam/system/man:"; export MANPATH;
PERL5LIB="/home/centos/.opam/system/lib/perl5"; export PERL5LIB;
OCAML_TOPLEVEL_PATH="/home/centos/.opam/system/lib/toplevel"; export OCAML_TOPLEVEL_PATH;
PATH="/home/centos/.opam/system/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/centos/.local/bin:/home/centos/bin"; export PATH;

I'm on a server running centos 7

Answer

Etan Reisner picture Etan Reisner · Jun 2, 2015

This command

eval 'opam config env'

is almost assuredly a typo and was supposed to be

eval `opam config env`

though using $(...) instead is the modern equivalent and avoids this font-fact confusion

eval $(opam config env)

That being said that just sets the environment variables in the current shell session (and exports them for use by processes run by this shell session).

As such that needs to be run in every shell session that needs those set (including each line of the makefile that expects them to be set if the environment that runs make doesn't already have them set and exported).