Skip to content

Directories whose names start with underscore get ignored for foreign build sandboxing #4795

@grievejia

Description

@grievejia

Expected Behavior

I'm trying to build a 3rd-party C library as part of my project using foreign build sandboxing.

I closely followed the instructions in the doc, but found out that my build failed because it cannot find files under any subdirectories whose name starts with _. Looking into the _build directory, I can confirm that files under those directories were just non-existent in the first place.

I understand the need to ignore those dirs when building OCaml sources. But dropping them for foreign libraries do not make too much sense for me.

Is there a good way to work around this problem at the moment? Ideally I would like to avoid making any changes to any pathnames of the 3rd-party library itself.

Actual Behavior

I expect all source files, regardless of their path names, get copied into the _build directory

Reproduction

Here's a small repro:

> ls
_build       _opam        dune-project test

> cat dune_project
(lang dune 2.9)

> tree test
test
└── lib
    ├── dune
    └── vendor
        ├── _b
        │   └── b.c
        └── a
            └── a.c

> cat test/lib/dune
(data_only_dirs vendor)

(rule
 (deps (source_tree vendor))
 (targets b.c)
 (action
 (no-infer
  (progn 
   (copy vendor/_b/b.c b.c)
   ))))

(library
 (name test))

> dune build
Error: _build/default/test/lib/vendor/_b/b.c: No such file or directory

# Note that if I change the source of the `copy` stanza into `vendor/a/a.c`, the build would succeed.

In my real setup, the actions would be more complicated (e.g. cd vendor && ./configure && make foo && cp libfoo.a ../libfoo.a). But this small example should be sufficient to demonstrate the crux of the problem here.

Specifications

  • Version of dune (output of dune --version): 2.9.0
  • Version of ocaml (output of ocamlc --version): 4.12.0
  • Operating system (distribution and version): macOS Big Sur

Additional information

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions