I am currently working on a library using Dune and Opam to drive the compilation and development. I am able at the moment to build the library with the dune-project
file below (I have removed identifying information that shouldn’t have any effect on the build):
(lang dune 3.11)
(name foo)
(generate_opam_files true)
(authors "...")
(maintainers "Maintainer Name")
(package
(name foo)
(synopsis "...")
(description "...")
(depends
(dune (>= 3.11))
(ocaml (= 5.1.1))
(base (= 0.16.2))
(ezcurl (= 0.2.4)))
(tags
(topics "to describe" your project)))
This builds fine and creates a opam project file like so:
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
synopsis: "..."
description: "..."
maintainer: ["Maintainer Name"]
authors: ["..."]
tags: ["topics" "to describe" "your" "project"]
depends: [
"dune" {>= "3.11" & >= "3.11"}
"ocaml" {= "5.1.1"}
"base" {= "0.16.2"}
"ezcurl" {= "0.2.4"}
"odoc" {with-doc}
]
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
However, I want to use the library in Opam so I can use it in an executable. When I attempt this (opam install .
), I get this error:
[NOTE] Ignoring uncommitted changes in
/Users/(...)/(...)/(...) (`--working-dir'
not active).
[foo.~dev] synchronised (no changes)
[ERROR] Package conflict!
* Missing dependency:
- base < v0.9.0
no matching version
No solution found, exiting
As you can see, I am using Base 0.16.3 and not anything less. I attempted to run opam upgrade --verbose
to see if I could figure out what was going on. I got this error:
Constructing initial basis...
Number of 0-1 knapsack inequalities = 9
Constructing conflict graph...
Conflict graph has 6 + 1 = 7 vertices
Everything as up-to-date as possible (run with --verbose to show unavailable
upgrades).
However, you may "opam upgrade" these packages explicitly, which will ask
permission to downgrade or uninstall the conflicting packages.
Nothing to do.
Additionally, while I was attempting to sort this out, I got this error:
Constructing initial basis...
Number of 0-1 knapsack inequalities = 9
Constructing conflict graph...
Conflict graph has 6 + 1 = 7 vertices
Everything as up-to-date as possible.
The following newer versions couldn't be installed:
- ocamlbuild.0.14.2+win: unmet availability conditions: 'os = "win32"'
However, you may "opam upgrade" these packages explicitly, which will ask
permission to downgrade or uninstall the conflicting packages.
Nothing to do.
I am on a Mac so I am not sure why this was there at all. I tried to remove it but I couldn’t so I just removed ocamlbuild completely from my install to see if that would fix it (this also removed utop but I don’t really care about that right now). I have also completely re-initalized Opam because I thought maybe its state had somehow become corrupt but that led to the same situation. Also, I thought this might have to do with the machine I was running this on but I got the same error on a Linux machine that has a different install of Opam+Dune on it. I am kind of at the end of my knowledge on how to get this to work. Is there something that I am missing to install a local library that is under heavy development into Opam so I can use it else where? I am not sure what I did to mess up my Opam install as well. Any advice would be gratefully received.