An error I am having when building a DAML project

G-d willing

I am having a weird issue that prevents me from building a daml project.
While the same code builds correctly on another machine, on my computer it doesn’t.So I know it is not related directly to the code

Right after I am executing daml build, I am getting 2 error messages indicating:

File:     daml
Hidden:   no
Range:    1:1-1:7
Source:   parser
Severity: DsError
Message:  daml:1:1: error: parse error on input ../../

Does anyone know why this is happening?

Could you provide more details about the system / setup you’re using?

Are you using Windows and does your project have a symlink? It looks like ../.. is actually the content of the file. In some cases symlinks get translated into a file containing the file path on Windows.

1 Like

It appears to be due to checking out a git repo with a symlink on Windows, without having git symlinks set up to work in Windows, as in this previous issue.

1 Like

No, I am not using symlinks…
I even did a fresh install of a Linux machine, and I am getting the same error there as well.

Regarding that previous post, the project was updated accordingly so it won’t use symlinks. So all Windows developers won’t have this issue again.

Does the string ../.. appear anywhere in your project, either in Daml source files or in daml.yaml? How much of your project can you publicly share? Having access to the code would make debugging that kind of issue a lot easier.

Perhaps you could share the result of

git grep '../..'

run from the root of your project?

The feature you were referring to in the previous post is not what you thought. Here’s what you observed:

  1. Cloning a project on Linux creates a symlink, builds successfully.
  2. Cloning it on Windows creates a file with a path as its only content instead of the symlink.
  3. This doesn’t build on Windows.

Your hypothesis to explain these was that there was a feature that lets you create a regular file with a path in it and use that as your source, or in other words:

But this isn’t the case; there is no such feature. The true explanation for the behavior you observed was that checking out the build on Linux created the symlink, and therefore the build was successful, whereas your checkout on Windows did not create a symlink, and therefore the build didn’t work.

Therefore taking out the symlink will not fix the issue you’re having; it will just make it so you also have the issue on Linux. You must use more symlinks to fix the issue, not fewer. The other possibility is to point the source property directly to a real directory containing the sources, so that the symlink is not needed.

G-d willing

I truly appreciate your effort in trying to resolve this. I did try a few things you suggested.
But, whatever resolved the issue was something else.
The issue was resolved when I downloaded the entire code by doing a git clone.
I will explain, first, that when I reported the issue, I downloaded the code from git from Azure by choosing: “Download as Zip”, and NOT by pulling the code directly from git (since the new laptop was not yet configured with my git account).
I don’t know why it made a difference since the bottom line is the same files (at least it is supposed to be the same)…

The best explanation I can think of is that it is not exactly the same files; that is, the Zip did not include a symlink, but your git clone created symlinks successfully. Zip doesn’t support symlinks, so there is no way to fix this.

Regardless, going forward, please keep in mind that a regular file (i.e. not a symlink) containing only a path to a directory is not a valid setting for the source property in daml.yaml.

Got you… thank you very much for the explanation.
I believe that this was the reason for the failure.