-
Notifications
You must be signed in to change notification settings - Fork 469
Directories whose names start with underscore get ignored for foreign build sandboxing #4795
Description
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 ofdune --version): 2.9.0 - Version of
ocaml(output ofocamlc --version): 4.12.0 - Operating system (distribution and version): macOS Big Sur
Additional information
- Link to gist with verbose output (run
dunewith the--verboseflag): https://gist.github.com/grievejia/bec0c7c4fdd0546793aca817659d320f