[SOLVED] Ocamlfind can't find lexer in default folder compiler-libs

Hi all, I’m trying to revive and modernise the project iocamljs by Andrew Ray. Here’s my fork branch: https://github.com/vietlq/iocamljs/tree/scratch/modernise-build

I was able to compile initially but somehow it stopped compiling. The issue is ocamlfind can’t find lexer in default folder compiler-libs. I’m using macos Mojavee and OCaml 4.06.1.

The steps to reproduce:

git clone https://github.com/vietlq/iocamljs.git
cd iocamljs
git fetch --all
git checkout scratch/modernise-build

make clean full

The error logs:

rm -f *.cmis.js
rm -f *.cm[ioa] iocaml_full.byte iocaml.byte iocaml.js
rm -fr *~
ocamlfind ocamlc -c exec.mli
ocamlfind ocamlc -package lexer -package js_of_ocaml -package js_of_ocaml-ppx \
		-package str,dynlink,js_of_ocaml,js_of_ocaml.compiler,js_of_ocaml.toplevel \
		-I /Users/vietlq/.opam/4.06.1/lib/ocaml/compiler-libs \
		exec.ml
ocamlfind: Package `lexer' not found
make: *** [exec.cmo] Error 2

I actually have lexer files by default:

$ ls -ltra $HOME/.opam/4.06.1/lib/ocaml/compiler-libs/*lexer*

$HOME/.opam/4.06.1/lib/ocaml/compiler-libs/lexer.cmi
$HOME/.opam/4.06.1/lib/ocaml/compiler-libs/lexer.cmt
$HOME/.opam/4.06.1/lib/ocaml/compiler-libs/lexer.cmti
$HOME/.opam/4.06.1/lib/ocaml/compiler-libs/lexer.mli
$HOME/.opam/4.06.1/lib/ocaml/compiler-libs/lexer.cmx

Any help is appreciated.

The (sub)package containing the lexer is compiler-libs.common .

1 Like

Thanks. The updated command is (added -linkpkg too as suggested by Nicholas from Lexifi):

ocamlfind ocamlc -linkpkg \
		-package compiler-libs.common \
	   	-package js_of_ocaml \
		-package js_of_ocaml-ppx \
		-package str,dynlink,js_of_ocaml,js_of_ocaml.compiler,js_of_ocaml.toplevel \
		exec.ml