You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ dune build
Shared cache miss [ade1dd90443baf5da8fdfbfdbb361da2] (_build/_fetch/checksum/sha256=79f2a1a5044a91350a0eb6ce12e261a72a2855c094c425cddf3860e58c486678/file): error: Unix.Unix_error(Unix.EXDEV, "link", "_build/_fetch/checksum/sha256=79f2a1a5044a91350a0eb6ce12e261a72a2855c094c425cddf3860e58c486678/file")
Shared cache miss [5d92998893da295b6f15bd934562286c] (_build/_fetch/checksum/sha256=48554abfd530fcdaa08f23f801b699e4f74c320ddf7d0bd56b0e8c24e55fc911/dir): error: Unix.Unix_error(Unix.EXDEV, "link", "_build/_fetch/checksum/sha256=48554abfd530fcdaa08f23f801b699e4f74c320ddf7d0bd56b0e8c24e55fc911/dir/.depend")
Shared cache miss [58d11cdd53fe9843bb800519a28cebb7] (_build/_private/default/.pkg/ocaml-base-compiler/source): error: Unix.Unix_error(Unix.EXDEV, "link", "_build/_private/default/.pkg/ocaml-base-compiler/source/.depend")
Downloading ocaml-base-compiler.5.2.0
Building ocaml-base-compiler.5.2.0
Shared cache miss [ede1c66e2f3dfb926f5192964f292058] (_build/_fetch/checksum/sha256=a9ad8d84a08961159653a978db92d10f694510182b206cacb96d5c9f63b5121e/file): error: Unix.Unix_error(Unix.EXDEV, "link", "_build/_fetch/checksum/sha256=a9ad8d84a08961159653a978db92d10f694510182b206cacb96d5c9f63b5121e/file")
Shared cache miss [a0373f043fbd093a22168f4ce761b26d] (_build/_fetch/checksum/sha256=6e4fd93f4cce6bad0ed3c08afd0248dbe7d7817109281de6294e5b5ef5597051/file): error: Unix.Unix_error(Unix.EXDEV, "link", "_build/_fetch/checksum/sha256=6e4fd93f4cce6bad0ed3c08afd0248dbe7d7817109281de6294e5b5ef5597051/file")
Building ocaml-config.3
Despite these errors the build completed successfully, so I guess it failed to use the cached files and just downloaded and built them again.
This was when building a project inside /tmp, which is a different filesystem to my home directory (where the dune cache is stored). I don't get this error when building a project inside my home directory so I suspect the way that dune symlinks cache entries into projects doesn't work across filesystem boundaries.
The shared dune cache uses hard links by default, which do not work across file systems. You can use file copies instead (less performant) by setting (cache-storage-mode copy) in your Dune config file.
Good to know. I wonder how hard it would be for dune to detect when the project and cache are on different filesystems and adjust its behaviour accordingly, or at least not attempt to use the cache (or print a more meaningful error message).
I think the only good way is to attempt to create a hardlink and see if it fails:
$ ln dune.exe /tmp/dune.exe
ln: failed to create hard link '/tmp/dune.exe' => 'dune.exe': Invalid cross-device link
Which I guess is exactly the Unix.Unix_error(Unix.EXDEV, "link", ...) error from the report. Maybe the cache should then just transparently switch to copying?
While building the simple project described in the package management tutorial I get the following errors:
Despite these errors the build completed successfully, so I guess it failed to use the cached files and just downloaded and built them again.
This was when building a project inside /tmp, which is a different filesystem to my home directory (where the dune cache is stored). I don't get this error when building a project inside my home directory so I suspect the way that dune symlinks cache entries into projects doesn't work across filesystem boundaries.
My dune is:
I'm on nixos.
The text was updated successfully, but these errors were encountered: