Opam & git strategy for repos with symlinks on Windows

Hello Daniel,

I had to add :


opam pin add odoc-parser –dev-repo

opam pin add odoc –dev-repo

opam pin add odig –dev-repo

(not the “repo” instead of “reop” below, but I assume it was a typo)

Nevertheless odig still do not compile :


PS H:\OCaml\stdlib-theme> opam pin add odig --dev-repo

[NOTE] Package odig is already pinned to git+https://erratique.ch/repos/odig.git (version 0.0.9).

[odig.0.0.9] synchronised (no changes)

odig is now pinned to git+https://erratique.ch/repos/odig.git (version 0.0.9)

[NOTE] It seems you have not updated your repositories for a while. Consider updating them with:

opam update

The following actions will be performed:

=== install 1 package

∗ odig 0.0.9 (pinned)

Proceed with ∗ 1 installation? [y/n] y

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><> 🐫

⬇ retrieved odig.0.0.9 (no changes)

[ERROR] The compilation of odig.0.0.9 failed at "ocaml pkg/pkg.ml build --dev-pkg true".

#=== ERROR while compiling odig.0.0.9 =========================================#

# context 2.2.1 | win32/x86_64 | | pinned(git+https://erratique.ch/repos/odig.git#d0669d77cf97e68d9f7849e1006d17b748ea255c)

# path H:\OCaml\stdlib-theme\_opam\.opam-switch\build\odig.0.0.9

# command H:\OCaml\stdlib-theme\_opam\bin\ocaml.exe pkg/pkg.ml build --dev-pkg true

# exit-code 1

# env-file ~\AppData\Local\opam\log\odig-12548-d6880e.env

# output-file ~\AppData\Local\opam\log\odig-12548-d6880e.out

### output ###

# pkg.ml: [ERROR] cmd ["ocamlbuild" "-use-ocamlfind" "-classic-display" "-j" "4" "-tag" "debug"

# [...]

# "themes/gruvbox.light/fonts/PTS75F.woff2"

# "themes/gruvbox.light/fonts/PTS56F.woff2"

# "themes/gruvbox.light/fonts/PTS55F.woff2"

# "themes/gruvbox.light/fonts/PTC75F.woff2"

# "themes/gruvbox.light/fonts/PTC55F.woff2"

# "themes/gruvbox.light/fonts/DejaVuSansMono.woff2"

# "themes/gruvbox.light/fonts/DejaVuSansMono-Oblique.woff2"

# "themes/gruvbox.light/fonts/DejaVuSansMono-BoldOblique.woff2"

# "themes/gruvbox.light/fonts/DejaVuSansMono-Bold.woff2"

# "themes/gruvbox.light/fonts/fonts.css" "themes/gruvbox.light/manual.css"

# "themes/gruvbox.light/theme.css" "themes/gruvbox.light/odoc.css"]: exited with 6

<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><> 🐫

┌─ The following actions failed

│ λ build odig 0.0.9

└─

╶─ No changes have been performed

[NOTE] Pinning command successful, but your installed packages may be out of sync.

Could you please open an issue on odig with the complete logs ^

Sure. Here you go : Path/PATH conflicts on windows OS · Issue #79 · b0-system/odig · GitHub

As I mentioned in this issue this is likely a problem due to the use of symlinks in the repository for theme fonts.

Is there a strategy at the opam on windows level so that we can either detect or fix these conditions ? So that we can instruct windows users to opam pin --dev-repo packages without fear ? What is the fix ? This ?

Developer Mode is the first thing checked for by opam init. If it’s not enabled, you get:

C:\Users\DRA>opam init
No configuration file found, using built-in defaults.

<><> Windows Developer Mode <><><><><><><><><><><><><><><><><><><><><><><><>  🐫
opam does not require Developer Mode to be enabled on Windows, but it is
recommended, in particular because it enables support for symlinks without
requiring opam to be run elevated (which we do not recommend doing).

More information on enabling Developer Mode may be obtained from
https://learn.microsoft.com/en-gb/windows/apps/get-started/enable-your-device-for-development

There’s always more that can be done, especially as there are scenarios (in education, in particular) where enabling developer mode is not an option. However, I expect the improvements are most likely to be more friendly error messages, than automated workarounds. The most reliable solution for pain-free cross-platform pinning sadly is not to use symlinks in a repo in the first place (where possible, set them up in a build, for example - with a fallback to copy when symlinking isn’t available - but I realise that’s not a universal solution either).

2 Likes