I use the library to LZMA 7z SDK with ctypes and if I build it locally it builds without any problem. But as long as I do it from the higher-level directory in docker it fails with these errors:
Error: No rule found for lib/lzma_7z/7zip/liblzma_7z.a
File "lib/lzma_7z/dune", line 12, characters 0-350:
...
Error: No rule found for lib/lzma_7z/7zip/liblzma_7z.so
File "lib/lzma_7z/dune", line 12, characters 0-350:
(rule
(deps (source_tree 7zip))
(targets liblzma_7z_stubs.a dlllzma_7z_stubs.so)
(action (progn
(chdir 7zip (run make clean))
(chdir 7zip (run make liblzma_7z.a))
(chdir 7zip (run make liblzma_7z.so))
(copy 7zip/liblzma_7z.a liblzma_7z_stubs.a)
(copy 7zip/liblzma_7z.so dlllzma_7z_stubs.so)
(chdir 7zip (run make clean))
)))
Ah, Dune is trying to be too clever here: when it sees (copy a b), it will assume that a is a dependency and b is a target. However, it can’t know that (run make liblzma_7z.a) produces liblzma_7z.a, so it thinks that 7zip/liblzma_7z.a is a dependency of the whole rule. I suppose we could add an option to disable dependency/target inference.