Problem installing a pinned package with opam

  1. I had a switch called 4.04.2 which I was using to develop a project using qcheck
  2. The latest qcheck on opam was missing an unreleased feature so I added a pin to its --dev-repo for it
  3. The unreleased feature was not working properly so I tried to see if I could fix it
  4. Created a new switch called qcheck-dev with --alias-of 4.04.2 and pinned a checkout of qcheck in it
  5. Modified qcheck, did opam upgrade qcheck and my experimental fix worked
  6. Now I wanted to pin the same modified local checkout of qcheck to my 4.04.2 switch
  7. Opam tells me that qcheck needs to be installed, I press Y
  8. make install fails because of some file existing in the other qcheck-dev switch
  9. I removed the qcheck-dev switch but make install keeps failing, again because of missing files in ~/.opam/qcheck-dev. This is after having run opam switch 4.04.2 and the related eval command

Does qcheck use oasis? oasis creates a setup.data file with links to the version of the compiler it was configured for, and fails to update it automatically. If you pin in path mode (the default), opam will copy this wrong information.

Solutions if that’s the problem:

  • Delete setup.data,
  • opam pin -k git to avoid copying untracked files, or
  • stop using oasis

Thanks, after digging around I noticed that setup.data contained many references to the switch where I pinned qcheck initially. Removed setup.data and then was able to make it work.

If you ‘opam pin add qcheck .’, it will use ‘rsync’ to copy ‘.’ to its
build directory. Instead, I always pin in git mode (using ‘opam pin add
-k git qcheck pwd#HEAD’), which then uses the HEAD of the local git
clone. This means not using any temporary files which are around – but
you have to git commit locally before reinstalling.

I see. Thanks for the suggestion. Might be useful at some point.