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

ctypes' deps field doesn't follow the dependency specification language #11440

Open
Khady opened this issue Feb 4, 2025 · 2 comments
Open

ctypes' deps field doesn't follow the dependency specification language #11440

Khady opened this issue Feb 4, 2025 · 2 comments
Labels
config-file Everything related to dune configuration file (workspace, project, dune)

Comments

@Khady
Copy link
Contributor

Khady commented Feb 4, 2025

Expected Behavior

The documentation of the cytpes feature mentions that there is support for deps, with the usual dependency specification language

https://dune.readthedocs.io/en/stable/foreign-code.html#ctypes-field-reference

Since the Dune’s ctypes feature is still experimental, it could be useful to add additional dependencies in order to make sure that local headers or libraries are available: (deps ). See Dependency Specification for more details.

So I expect to be able to write

 (ctypes
  (external_library_name somelib)
  (build_flags_resolver pkg_config)
  (deps
   (:h "ocaml_bindings.h"))
  (headers
   (preamble "#include \"ocaml_bindings.h\""))
  (type_description
   (instance Type)
   (functor Type_description))
  (function_description
   (concurrency sequential)
   (instance Functions)
   (functor Function_description))
  (generated_types Types_generated)
  (generated_entry_point C))

Actual Behavior

File "backend/cassandra_client/dune", line 14, characters 3-26:
14 |    (:h "ocaml_bindings.h"))
        ^^^^^^^^^^^^^^^^^^^^^^^
Error: Unexpected list

Reproduction

  1. setup a basic project like indicated in https://dune.readthedocs.io/en/stable/foreign-code.html#a-toy-example
  2. create an ocaml_bindings.h file
  3. add (deps (:h "ocaml_bindings.h"))
  4. dune build

Specifications

  • Version of dune (output of dune --version): 3.16.0
  • Version of ocaml (output of ocamlc --version): 4.14
  • Operating system (distribution and version): debian 12
@maiste
Copy link
Collaborator

maiste commented Feb 4, 2025

 (ctypes
  ;; [...]
  (deps
   (:h ocaml_bindings.h))
  ;; [...]

It might be a dummy suggestion, but can you try without the quotes?

Because, looking at the code, the decoder is supposed to take a list

and+ deps = field_o "deps" (repeat Dep_conf.decode)
(the type is Dep_conf.t list option as expected. I don't see why it would fail...

@maiste maiste added the config-file Everything related to dune configuration file (workspace, project, dune) label Feb 4, 2025
@Khady
Copy link
Contributor Author

Khady commented Feb 5, 2025

the error is the same without the quotes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config-file Everything related to dune configuration file (workspace, project, dune)
Projects
None yet
Development

No branches or pull requests

2 participants