Multi package build issue


I’m working on a project that includes Daml Finance as a submodule and uses it as a dependency.
This project has multiple daml.yaml files and so, I’m leveraging a multi-package.yaml to build all of them.
To build the daml-finance dar fiile, I’m using the makefile target that is included in the project, but I’m get the following error.

damlc: Running multi-package build of daml-finance.
Failed to read daml.yaml
CallStack (from HasCallStack):
  error, called at compiler/damlc/lib/DA/Cli/Damlc.hs:1723:17 in compilerZSdamlcZSdamlc-lib:DA.Cli.Damlc
make: *** [Makefile:13: build] Error 1

But if I remove the multi-package.yaml file from the “parent” project this error no longer appears. Can you help with this issue?

Thank you

Hi David!
Can you confirm if your multi-package.yaml references any of the daml-finance package sources?
It may be that multi-build is trying to build one of the daml finance packages, which use a customised daml.yaml structure at the moment.
As a side note, we intend to change daml-finance to match multi-build soon.

It does not reference the daml finance lib at all, but upon further testing we noticed that the daml build command was going down the file tree “in search” of a multi-package.yaml file. As a work around, we removed the multi package file form the project root and into a different directory and the daml finance build occurs without issue.

Glad you were able to find a fix. You can also use the --multi-package-path flag to explicitly tell daml build where to find the relevant multi-package.yaml

Edit: I think I misunderstood the issue at first, this issue will also be solved once we move daml-finance over to mult-build in the near future.

Although we did manage to fix it, I’m not sure this would be a daml-finance specific issue, but any dependency as submodule where the underlying project has a multi-package.yaml file.
It’s a bit of an odd behaviour that a daml cli command that is run a a specific dir, tries to check the parent dirs for a file by default. Additionally (not sure if this is intended), the --multi-package.yaml flag only allows to point to a specific directory but not a name change on the yaml file.

Thank you

This is something we deliberated over internally for a short while. The reason the file is searched for is to allow single package builds for a nested structure to use the data in the multi-package.yaml.
Usually, this wouldn’t be an issue for standalone dependencies, as they wouldn’t have any common dependencies listed.
The reason this is an issue for daml-finance is their custom daml.yaml format, which is read to build up a context of the project before actually building.
In light of your comment though, I’ll bring this decision back up to see if there’s a better way to handle it.

Regarding the --multi-package-path flag, specifying the directory is intentional to match the behaviour of --project-root, though I see the flag description doesn’t reflect that, and perhaps it should be --multi-package-root.
I’ll look into this as well.

Thanks very much for the feedback!


The option can remain the same, but the description could be adjusted to specify it needs to point to a “multi-package.yaml”, much like the --project-root does and instead of saying it takes a “FILE” it takes an “ARG”.
In any case thank you for your replies.