Stream: Elpi users & devs

Topic: Binding Elpi


view this post on Zulip Philip (Aug 28 2023 at 10:15):

Does anyone know how to resolve a "Error: No implementations provided for the following modules: Unix referenced from .../elpi_util.cmxa(Elpi_util__Util)"? Adding -package Unix doesn't change anything either, then ocamlfind just responds with "Package `Unix' not found". This might be a stupid question, but my experience with Ocaml and OPAM is limited.

view this post on Zulip Philip (Aug 28 2023 at 10:31):

Nevermind, apparently this was an issue in the order of the arguments. -package unix -package elpi works, but -package elpi or -package elpi -package unix doesn't.

view this post on Zulip Enrico Tassi (Aug 28 2023 at 11:01):

That is a bit weird since the elpi package should pull in the dependency on unix.
Eg

$ cat /home/tassi/LPCIC/_opam/default/lib/elpi/META
version = "1.16.10"
description = ""
requires =
"elpi.parser
 elpi.trace.runtime
 elpi.util
 ppx_deriving.runtime
 re.str
 stdlib-shims
 unix"
archive(byte) = "elpi.cma"
archive(native) = "elpi.cmxa"
plugin(byte) = "elpi.cma"
plugin(native) = "elpi.cmxs"
package "lexer_config" (
  directory = "lexer_config"
  version = "1.16.10"
  description = ""
  requires = "elpi.util"
  archive(byte) = "elpi_lexer_config.cma"
  archive(native) = "elpi_lexer_config.cmxa"
  plugin(byte) = "elpi_lexer_config.cma"
  plugin(native) = "elpi_lexer_config.cmxs"
)
...

Can you say a bit more what your setup looks like?

view this post on Zulip Philip (Aug 28 2023 at 15:24):

I am working on Debian Old-Stable, and have installed ELPI using OPAM. Is there anything in particular you would want to know about?

view this post on Zulip Enrico Tassi (Aug 28 2023 at 18:32):

No. But you could try to add -verbose to you ocaml find incantation to see what it is really passing to ocamlc

view this post on Zulip Enrico Tassi (Aug 28 2023 at 18:35):

If it does not pass unix.cmxa, Is your META file like mine?

view this post on Zulip Philip (Aug 30 2023 at 08:48):

In that case the command with ... -package elpi ... gives me:

Effective set of compiler predicates: pkg_seq,pkg_re,pkg_re.str,pkg_elpi.util,pkg_elpi.lexer_config,pkg_menhirLib,pkg_result,pkg_ppx_deriving.runtime,pkg_stdlib-shims,pkg_unix,pkg_elpi.parser,pkg_elpi.trace.runtime,pkg_elpi,autolink,byte
+ ocamlc.opt -verbose -g -o myprogram -I /proj/ciptmp/oj14ozun/opam/default/lib/seq -I /proj/ciptmp/oj14ozun/opam/default/lib/re -I /proj/ciptmp/oj14ozun/opam/default/lib/re/str -I /proj/ciptmp/oj14ozun/opam/default/lib/elpi/util -I /proj/ciptmp/oj14ozun/opam/default/lib/elpi/lexer_config -I /proj/ciptmp/oj14ozun/opam/default/lib/menhirLib -I /proj/ciptmp/oj14ozun/opam/default/lib/result -I /proj/ciptmp/oj14ozun/opam/default/lib/ppx_deriving/runtime -I /proj/ciptmp/oj14ozun/opam/default/lib/stdlib-shims -I /proj/ciptmp/oj14ozun/opam/default/lib/elpi/parser -I /proj/ciptmp/oj14ozun/opam/default/lib/elpi/trace/runtime -I /proj/ciptmp/oj14ozun/opam/default/lib/elpi /proj/ciptmp/oj14ozun/opam/default/lib/re/re.cma /proj/ciptmp/oj14ozun/opam/default/lib/re/str/re_str.cma /proj/ciptmp/oj14ozun/opam/default/lib/elpi/util/elpi_util.cma /proj/ciptmp/oj14ozun/opam/default/lib/elpi/lexer_config/elpi_lexer_config.cma /proj/ciptmp/oj14ozun/opam/default/lib/menhirLib/menhirLib.cma /proj/ciptmp/oj14ozun/opam/default/lib/result/result.cma /proj/ciptmp/oj14ozun/opam/default/lib/ppx_deriving/runtime/ppx_deriving_runtime.cma /proj/ciptmp/oj14ozun/opam/default/lib/stdlib-shims/stdlib_shims.cma /usr/lib/ocaml/unix.cma /proj/ciptmp/oj14ozun/opam/default/lib/elpi/parser/elpi_parser.cma /proj/ciptmp/oj14ozun/opam/default/lib/elpi/trace/runtime/trace_ppx_runtime.cma /proj/ciptmp/oj14ozun/opam/default/lib/elpi/elpi.cma createaquery.ml
File "createaquery.ml", line 1:
Error: Required module `Unix' is unavailable
ocamlc.opt returned with exit code 2

with -package elpi -package unix gives me

Effective set of compiler predicates: pkg_seq,pkg_re,pkg_re.str,pkg_elpi.util,pkg_elpi.lexer_config,pkg_menhirLib,pkg_result,pkg_ppx_deriving.runtime,pkg_stdlib-shims,pkg_unix,pkg_elpi.parser,pkg_elpi.trace.runtime,pkg_elpi,autolink,byte
+ ocamlc.opt -verbose -g -o myprogram -I /proj/ciptmp/oj14ozun/opam/default/lib/seq -I /proj/ciptmp/oj14ozun/opam/default/lib/re -I /proj/ciptmp/oj14ozun/opam/default/lib/re/str -I /proj/ciptmp/oj14ozun/opam/default/lib/elpi/util -I /proj/ciptmp/oj14ozun/opam/default/lib/elpi/lexer_config -I /proj/ciptmp/oj14ozun/opam/default/lib/menhirLib -I /proj/ciptmp/oj14ozun/opam/default/lib/result -I /proj/ciptmp/oj14ozun/opam/default/lib/ppx_deriving/runtime -I /proj/ciptmp/oj14ozun/opam/default/lib/stdlib-shims -I /proj/ciptmp/oj14ozun/opam/default/lib/elpi/parser -I /proj/ciptmp/oj14ozun/opam/default/lib/elpi/trace/runtime -I /proj/ciptmp/oj14ozun/opam/default/lib/elpi /proj/ciptmp/oj14ozun/opam/default/lib/re/re.cma /proj/ciptmp/oj14ozun/opam/default/lib/re/str/re_str.cma /proj/ciptmp/oj14ozun/opam/default/lib/elpi/util/elpi_util.cma /proj/ciptmp/oj14ozun/opam/default/lib/elpi/lexer_config/elpi_lexer_config.cma /proj/ciptmp/oj14ozun/opam/default/lib/menhirLib/menhirLib.cma /proj/ciptmp/oj14ozun/opam/default/lib/result/result.cma /proj/ciptmp/oj14ozun/opam/default/lib/ppx_deriving/runtime/ppx_deriving_runtime.cma /proj/ciptmp/oj14ozun/opam/default/lib/stdlib-shims/stdlib_shims.cma /usr/lib/ocaml/unix.cma /proj/ciptmp/oj14ozun/opam/default/lib/elpi/parser/elpi_parser.cma /proj/ciptmp/oj14ozun/opam/default/lib/elpi/trace/runtime/trace_ppx_runtime.cma /proj/ciptmp/oj14ozun/opam/default/lib/elpi/elpi.cma createaquery.ml
File "createaquery.ml", line 1:
Error: Required module `Unix' is unavailable
ocamlc.opt returned with exit code 2

and the successful invocation (... -package unix -package elpi ...) says

Effective set of compiler predicates: pkg_unix,pkg_seq,pkg_re,pkg_re.str,pkg_elpi.util,pkg_elpi.lexer_config,pkg_menhirLib,pkg_result,pkg_ppx_deriving.runtime,pkg_stdlib-shims,pkg_elpi.parser,pkg_elpi.trace.runtime,pkg_elpi,autolink,byte
+ ocamlc.opt -verbose -g -o myprogram -I /proj/ciptmp/oj14ozun/opam/default/lib/seq -I /proj/ciptmp/oj14ozun/opam/default/lib/re -I /proj/ciptmp/oj14ozun/opam/default/lib/re/str -I /proj/ciptmp/oj14ozun/opam/default/lib/elpi/util -I /proj/ciptmp/oj14ozun/opam/default/lib/elpi/lexer_config -I /proj/ciptmp/oj14ozun/opam/default/lib/menhirLib -I /proj/ciptmp/oj14ozun/opam/default/lib/result -I /proj/ciptmp/oj14ozun/opam/default/lib/ppx_deriving/runtime -I /proj/ciptmp/oj14ozun/opam/default/lib/stdlib-shims -I /proj/ciptmp/oj14ozun/opam/default/lib/elpi/parser -I /proj/ciptmp/oj14ozun/opam/default/lib/elpi/trace/runtime -I /proj/ciptmp/oj14ozun/opam/default/lib/elpi /usr/lib/ocaml/unix.cma /proj/ciptmp/oj14ozun/opam/default/lib/re/re.cma /proj/ciptmp/oj14ozun/opam/default/lib/re/str/re_str.cma /proj/ciptmp/oj14ozun/opam/default/lib/elpi/util/elpi_util.cma /proj/ciptmp/oj14ozun/opam/default/lib/elpi/lexer_config/elpi_lexer_config.cma /proj/ciptmp/oj14ozun/opam/default/lib/menhirLib/menhirLib.cma /proj/ciptmp/oj14ozun/opam/default/lib/result/result.cma /proj/ciptmp/oj14ozun/opam/default/lib/ppx_deriving/runtime/ppx_deriving_runtime.cma /proj/ciptmp/oj14ozun/opam/default/lib/stdlib-shims/stdlib_shims.cma /proj/ciptmp/oj14ozun/opam/default/lib/elpi/parser/elpi_parser.cma /proj/ciptmp/oj14ozun/opam/default/lib/elpi/trace/runtime/trace_ppx_runtime.cma /proj/ciptmp/oj14ozun/opam/default/lib/elpi/elpi.cma createaquery.ml

view this post on Zulip Philip (Aug 30 2023 at 08:55):

The difference appears to really only be the order in which the directories are traversed. As I said, my experience with Ocaml is limited, but I am familiar with issues wrt the order of linking objects from C. Does this sound like a bug worth reporting?

view this post on Zulip Philip (Aug 30 2023 at 08:56):

Oh, and I am not using any special META file, this was just a single- .ml-file that I wanted to compile.

view this post on Zulip Enrico Tassi (Aug 30 2023 at 11:26):

I think I see the problem, the unix.cma archive is there since the beginning, but in the wrong position.
Indeed https://github.com/LPCIC/elpi/blob/master/src/utils/dune does not mention unix, but uses it.

view this post on Zulip Enrico Tassi (Aug 30 2023 at 11:27):

Thanks for reporting, I've opened a PR fixing the bug: https://github.com/LPCIC/elpi/pull/193


Last updated: Oct 13 2024 at 01:02 UTC