Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[E] Unbound type constructor Result.result #257

Closed
concatime opened this issue Feb 13, 2022 · 9 comments
Closed

[E] Unbound type constructor Result.result #257

concatime opened this issue Feb 13, 2022 · 9 comments

Comments

@concatime
Copy link

concatime commented Feb 13, 2022

Hi.
I'm trying to bootstrap FStar and it depends on ppx_deriving.
When trying to build v5.2.1, I get:

File "ppx_deriving.cppo.mli", line 109, characters 44-57:
Error: Unbound type constructor Result.result

I'm using the latest versions: [email protected], [email protected], [email protected], [email protected] and [email protected].
I’m very unfamiliar with OCaml environment, so bear with me :)

@concatime concatime changed the title Unbound type constructor Result.result [E] Unbound type constructor Result.result Feb 13, 2022
@gasche
Copy link
Contributor

gasche commented Feb 13, 2022

Result.result comes from the result package, do you have it installed? (Are you using the standard build instructions for ppx_deriving, or something different? It's strange that there is no complaint as it is listed as a dependency.)

I wonder if we shouldn't use Result.t instead, which should be equivalent and may work properly without the result package on recent-enough OCaml versions.

@kit-ty-kate
Copy link
Collaborator

It's strange that there is no complaint as it is listed as a dependency.)

I believe this is a consequance of a bug in dune fixed in dune 3.0.0: ocaml/dune#4946
The issue is that with dune < 3 the result library is a builtin in dune and so if it is used but not installed it will be defined as empty and will not contain Result.result (from older versions of the result compat library)

We could use Result.t indeed but we must not forget to add {>= "1.5"} to the result constraints.

@concatime
Copy link
Author

Well, you nailed it folks!
But now, after adding the result package, I get:

File "_none_", line 1:
Warning 58 [no-cmx-file]: no cmx file was found in path for module Dynlink, and its interface was not compiled with -opaque
File "_none_", line 1:
Warning 58 [no-cmx-file]: no cmx file was found in path for module Dynlink, and its interface was not compiled with -opaque
File "_none_", line 1:
Error: No implementations provided for the following modules:
         Dynlink referenced from /opt/ocaml/lib/ocaml/site-lib/findlib/findlib_dynload.cmxa(Fl_dynload),
           src/.ppx_deriving_main.eobjs/native/findlib_initl.cmx,
           src/.ppx_deriving_main.eobjs/native/ppx_deriving_main.cmx

@kit-ty-kate
Copy link
Collaborator

You seem to be missing the ocamlfind dependency

@kit-ty-kate
Copy link
Collaborator

You can see the list of all the requirements here: https://github.com/ocaml-ppx/ppx_deriving/blob/master/ppx_deriving.opam

@concatime
Copy link
Author

I definitely have ocamlfind installed (in the same path as OCaml):

ls /opt/ocaml/lib/ocaml/site-lib/findlib
findlib.a            findlib_dynload.cmxa  fl_lint.cmi          fl_topo.cmi
findlib.cma          findlib.mli           fl_meta.cmi          Makefile.config
findlib.cmi          findlib_top.a         fl_metascanner.cmi   Makefile.packages
findlib.cmxa         findlib_top.cma       fl_metascanner.mli   META
findlib_config.cmi   findlib_top.cmxa      fl_metatoken.cmi     ocaml_args.cmi
findlib_config.ml    fl_args.cmi           fl_package_base.cmi  topfind.cmi
findlib_dynload.a    fl_dynload.cmi        fl_package_base.mli  topfind.mli
findlib_dynload.cma  fl_dynload.mli        fl_split.cmi

I also have /opt/ocaml/bin/ocamlfind.

@concatime
Copy link
Author

Well, I was building OCaml with --enable-shared=no --enable-static=yes. It seems that ppx_deriving REQUIRES --enable-shared=yes. Am I right?

@kit-ty-kate
Copy link
Collaborator

ah yes, that’s correct. Most OCaml package will break without shared library support

@concatime
Copy link
Author

Ok, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants