Skip to content

Missing -I when building against a virtual library from another project #3636

@rlepigre

Description

@rlepigre

I am having a weird issue with a library containing a bunch of modules and one virtual_modules.
(The problem arises both with dune.2.0.1 and dune 2.6.1, I have not tried other versions.)

First, when the library is installed, no .cma or .cmxa files are installed by dune, and the META file has empty fields:

package "my_lib" (
  ...
  archive(byte) = ""
  archive(native) = ""
  plugin(byte) = ""
  plugin(native) = ""
)

Is that expected behaviour? I could find no clear explanation about that in the doc.

Second, and that is really the origin of my problem, when I try to compile another project depending on the virtual library, no corresponding -I option is generated. I am currently working around that using:

 (flags (:standard -I +../my_package/my_lib)) ; FIXME crazy hack.

with which everything works as expected. However, I feel like I should not have to do that, and my fix is really fragile due to the explicit path.

Unfortunately I cannot give access to the sources of the project (it is not currently open-source, and I am not sure how much information I can give about it). However, here is what the dune file of the library looks like (it is used by other libraries and executables of the same project):

; The library containing a virtual module
(library
 (name my_lib)
 (public_name my_package.my_lib)
 (synopsis "...")
 (modules :standard)
 (virtual_modules virtual)
 (libraries ...))

And here is what the dune file of the (independent) project trying to use the library looks like:

; The executable trying to use the library with the virtual module
(executable
 (name main)
 (public_name my_program)
 (package my_other_package)
 (flags (:standard -w -27 -I +../my_package/my_lib)) ; FIXME crazy hack.
 (libraries cmdliner str unix ... my_package.my_lib my_package.impl_of_virt))

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions