makefileocamlopamocamlfind

ocamlfind: command not found


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

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 it updates my bin.

The output when running 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;

Solution

  • You need to run

    eval `opam config env`
    

    or using $(...) instead is the modern equivalent and avoids confusion between ' and `

    eval $(opam config env)
    

    This eval command sets the environment variables in the current shell session and exports them for use by processes run by this shell session, so it 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.

    The command you ran

    eval 'opam config env'
    

    is a typo.