Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not resolve dependencies #1883

Closed
wjrforcyber opened this issue Oct 10, 2021 · 18 comments
Closed

Could not resolve dependencies #1883

wjrforcyber opened this issue Oct 10, 2021 · 18 comments

Comments

@wjrforcyber
Copy link

I am following this tutorial, but got this error:

$ cabal v2-build
Resolving dependencies...
cabal.exe: Could not resolve dependencies:
[__0] trying: EpsilonX-0.1.0.0 (user goal)
[__1] trying: liquidhaskell-0.8.10.2 (dependency of EpsilonX)
[__2] trying: liquid-fixpoint-0.8.10.2 (dependency of liquidhaskell)
[__3] trying: text-format-0.3.2 (dependency of liquid-fixpoint)
[__4] next goal: integer-gmp (dependency of text-format)
[__4] rejecting: integer-gmp-1.1/installed-1.1 (conflict: text-format =>
base>=4.3 && <4.15, integer-gmp => base==4.15.0.0/installed-4.15.0.0)
[__4] rejecting: integer-gmp-1.0.3.0, integer-gmp-1.0.2.0,
integer-gmp-1.0.1.0, integer-gmp-1.0.0.1, integer-gmp-1.0.0.0,
integer-gmp-0.5.1.0 (constraint from non-upgradeable package requires
installed instance)
[__4] fail (backjumping, conflict set: integer-gmp, text-format)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, text-format, integer-gmp,
liquid-fixpoint, liquidhaskell, EpsilonX
Try running with --minimize-conflict-set to improve the error message.

$ cabal --version
cabal-install version 3.4.0.0
compiled using version 3.4.0.0 of the Cabal library

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.0.1

Has anybody encountered with this issue?

@ranjitjhala
Copy link
Member

Yikes let me take a look!

@wjrforcyber
Copy link
Author

And if I use ghc version 8.10.1 or 8.10.3, the building process went well until the end, it will show:

src\Language\Haskell\Liquid\UX\Annotate.hs:446:31: error:
    • Couldn't match expected type ‘Key’ with actual type ‘T.Text’
    • In the first argument of ‘(.=)’, namely ‘tshow k’
      In the expression: tshow k .= toJSON a
      In the first argument of ‘object’, namely
        ‘[tshow k .= toJSON a | (k, a) <- M.toList kas]’
    |
446 |   toJSON (Asc kas) = object [ tshow k .= toJSON a | (k, a) <- M.toList kas ]
    |                               ^^^^^^^
cabal.exe: Failed to build liquidhaskell-0.8.10.2 (which is required by
exe:main from EpsilonX-0.1.0.0 and EpsilonX-0.1.0.0). See the build log above
for details.

@ranjitjhala
Copy link
Member

ranjitjhala commented Oct 12, 2021 via email

@wjrforcyber
Copy link
Author

I added the plugin to the dependencies in my won project, following the tutorial I mentioned above, just two steps:

First, adding a dependency to LH in the .cabal file (or package.yaml)
  build-depends:
      liquid-base,
      liquidhaskell >= 0.8.10
Second, tell GHC to use the plugin
  ghc-options: -fplugin=LiquidHaskell

and I have my .cabal file:

build-depends:
    base >= 4.12 && <= 5,
    mtl >= 2.2,
    parsec >= 3.1.14.0,
    prettyprinter >= 1.7.1,
    QuickCheck >= 2.14.2,
    liquid-base,
    liquidhaskell

  ghc-options:
    -Wall
    -Wextra
    -fplugin=LiquidHaskell

As I mentioned above in the first comment, at first, I used

$ cabal --version
cabal-install version 3.4.0.0
compiled using version 3.4.0.0 of the Cabal library

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.0.1

which has a conflict problem,

then I tried ghc 8.10.7, with the same cabal version 3.4.0.0, also conflict here, but only on base:

$ cabal new-build EpsilonX -w ghc-8.10.7
Resolving dependencies...
cabal.exe: Could not resolve dependencies:
[__0] trying: EpsilonX-0.1.0.0 (user goal)
[__1] trying: liquid-base-4.15.0.0 (dependency of EpsilonX)
[__2] next goal: base (dependency of EpsilonX)
[__2] rejecting: base-4.14.3.0/installed-4.14.3.0 (conflict: liquid-base =>
base==4.15.0.0)
[__2] rejecting: base-4.15.0.0, base-4.14.3.0, base-4.14.2.0, base-4.14.1.0,
base-4.14.0.0, base-4.13.0.0, base-4.12.0.0, base-4.11.1.0, base-4.11.0.0,
base-4.10.1.0, base-4.10.0.0, base-4.9.1.0, base-4.9.0.0, base-4.8.2.0,
base-4.8.1.0, base-4.8.0.0, base-4.7.0.2, base-4.7.0.1, base-4.7.0.0,
base-4.6.0.1, base-4.6.0.0, base-4.5.1.0, base-4.5.0.0, base-4.4.1.0,
base-4.4.0.0, base-4.3.1.0, base-4.3.0.0, base-4.2.0.2, base-4.2.0.1,
base-4.2.0.0, base-4.1.0.0, base-4.0.0.0, base-3.0.3.2, base-3.0.3.1
(constraint from non-upgradeable package requires installed instance)
[__2] fail (backjumping, conflict set: EpsilonX, base, liquid-base)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, liquid-base, EpsilonX

After thet I tried ghc 8.10.1 and ghc 8.10.3, with the same cabal version 3.4.0.0, no conflicts anymore, but showing error:

$ cabal v2-build EpsilonX -w ghc-8.10.3
Build profile: -w ghc-8.10.3 -O1
In order, the following will be built (use -v for more details):
 - liquidhaskell-0.8.10.2 (lib) (requires build)
 - liquid-ghc-prim-0.6.1 (lib:liquid-ghc-prim) (requires build)
 - liquid-base-4.14.1.0 (lib:liquid-base) (requires build)
 - EpsilonX-0.1.0.0 (exe:main) (first run)
 - EpsilonX-0.1.0.0 (lib) (first run)
Starting     liquidhaskell-0.8.10.2 (lib)
Building     liquidhaskell-0.8.10.2 (lib)

Failed to build liquidhaskell-0.8.10.2.
Build log (
...
src\Language\Haskell\Liquid\UX\Annotate.hs:446:31: error:
    • Couldn't match expected type ‘Key’ with actual type ‘T.Text’
    • In the first argument of ‘(.=)’, namely ‘tshow k’
      In the expression: tshow k .= toJSON a
      In the first argument of ‘object’, namely
        ‘[tshow k .= toJSON a | (k, a) <- M.toList kas]’
    |
446 |   toJSON (Asc kas) = object [ tshow k .= toJSON a | (k, a) <- M.toList kas ]
    |                               ^^^^^^^
cabal.exe: Failed to build liquidhaskell-0.8.10.2 (which is required by
exe:main from EpsilonX-0.1.0.0 and EpsilonX-0.1.0.0). See the build log above
for details.

OS: Windows 10

@yiwei-w
Copy link

yiwei-w commented Oct 12, 2021

I encountered the same problem on macOS 11.6. After making a fresh clone of the lh-plugin-demo repo and switching to ghc 8.10.2 with cabal 3.2.0.0, I got the following error when executing cabal v2-build:

src/Language/Haskell/Liquid/UX/Annotate.hs:446:31: error:
    • Couldn't match expected type ‘Key’ with actual type ‘T.Text’
    • In the first argument of ‘(.=)’, namely ‘tshow k’
      In the expression: tshow k .= toJSON a
      In the first argument of ‘object’, namely
        ‘[tshow k .= toJSON a | (k, a) <- M.toList kas]’
    |
446 |   toJSON (Asc kas) = object [ tshow k .= toJSON a | (k, a) <- M.toList kas ]
    |                               ^^^^^^^
cabal: Failed to build liquidhaskell-0.8.10.2.1 (which is required by
lh-plugin-demo-0.1.0.0).

@ranjitjhala
Copy link
Member

ranjitjhala commented Oct 12, 2021 via email

@wjrforcyber
Copy link
Author

Ah base and liquid-base are in conflict. use the liquid-base if you want LH

On Tue, Oct 12, 2021 at 7:15 AM yiwei-w @.***> wrote: I encountered the same problem on macOS. After making a fresh clone of the lh-plugin-demo repo and switching to ghc 8.10.2 with cabal 3.2.0.0, I got the following error when executing cabal v2-build: src/Language/Haskell/Liquid/UX/Annotate.hs:446:31: error: • Couldn't match expected type ‘Key’ with actual type ‘T.Text’ • In the first argument of ‘(.=)’, namely ‘tshow k’ In the expression: tshow k .= toJSON a In the first argument of ‘object’, namely ‘[tshow k .= toJSON a | (k, a) <- M.toList kas]’ | 446 | toJSON (Asc kas) = object [ tshow k .= toJSON a | (k, a) <- M.toList kas ] | ^^^^^^^ cabal: Failed to build liquidhaskell-0.8.10.2.1 (which is required by lh-plugin-demo-0.1.0.0). — You are receiving this because you commented. Reply to this email directly, view it on GitHub https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_ucsd-2Dprogsys_liquidhaskell_issues_1883-23issuecomment-2D941054427&d=DwMFaQ&c=-35OiAkTchMrZOngvJPOeA&r=r3JfTqNkpwIJ1InE9-ChC2ld7xwATxgUx5XHAdA0UnA&m=LB8uNPnMAMS_rDxQnekQ5T74wuiL6bDzq8ImpRXH4-Q&s=ygDJZrEu0Vxl2P5YXJCWFF5bVA75BaMB2ooTjwjuatE&e=, or unsubscribe https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AAMS4OGEBEZVZ7DMGZUIOXTUGQ7ITANCNFSM5FWNUBXA&d=DwMFaQ&c=-35OiAkTchMrZOngvJPOeA&r=r3JfTqNkpwIJ1InE9-ChC2ld7xwATxgUx5XHAdA0UnA&m=LB8uNPnMAMS_rDxQnekQ5T74wuiL6bDzq8ImpRXH4-Q&s=zl5q9vhDm_15YAEkxLsqITuC8leG-pQxub0fFP0ok1E&e= . Triage notifications on the go with GitHub Mobile for iOS https://urldefense.proofpoint.com/v2/url?u=https-3A__apps.apple.com_app_apple-2Dstore_id1477376905-3Fct-3Dnotification-2Demail-26mt-3D8-26pt-3D524675&d=DwMFaQ&c=-35OiAkTchMrZOngvJPOeA&r=r3JfTqNkpwIJ1InE9-ChC2ld7xwATxgUx5XHAdA0UnA&m=LB8uNPnMAMS_rDxQnekQ5T74wuiL6bDzq8ImpRXH4-Q&s=XoH97hPC2Gcwmoshg4p01GtR9avjl9A5lwThF0tw8HU&e= or Android https://urldefense.proofpoint.com/v2/url?u=https-3A__play.google.com_store_apps_details-3Fid-3Dcom.github.android-26referrer-3Dutm-5Fcampaign-253Dnotification-2Demail-2526utm-5Fmedium-253Demail-2526utm-5Fsource-253Dgithub&d=DwMFaQ&c=-35OiAkTchMrZOngvJPOeA&r=r3JfTqNkpwIJ1InE9-ChC2ld7xwATxgUx5XHAdA0UnA&m=LB8uNPnMAMS_rDxQnekQ5T74wuiL6bDzq8ImpRXH4-Q&s=uFspTMqvwtUv-09Yna8SfQCq6bm-peaDTJN3yehdbs8&e=.

I have tried with liquid-haskell base without base but still won't work...

@yiwei-w
Copy link

yiwei-w commented Oct 15, 2021

Try building with stack instead of cabal. I got mine working after removing the dependency on base in the .cabal file and building with stack.

@njayinthehouse
Copy link

I have the same problem as @wjrforcyber.

» cabal v2-build -w ghc-8.10.7 --minimize-conflict-set
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: mergesort-0.1.0.0 (user goal)
[__1] trying: liquid-base-4.15.0.0 (dependency of mergesort)
[__2] next goal: base (dependency of liquid-base)
[__2] rejecting: base-4.14.3.0/installed-4.14.3.0 (conflict: liquid-base =>
base==4.15.0.0)
[__2] rejecting: base-4.15.0.0, base-4.14.3.0, base-4.14.2.0, base-4.14.1.0,
base-4.14.0.0, base-4.13.0.0, base-4.12.0.0, base-4.11.1.0, base-4.11.0.0,
base-4.10.1.0, base-4.10.0.0, base-4.9.1.0, base-4.9.0.0, base-4.8.2.0,
base-4.8.1.0, base-4.8.0.0, base-4.7.0.2, base-4.7.0.1, base-4.7.0.0,
base-4.6.0.1, base-4.6.0.0, base-4.5.1.0, base-4.5.0.0, base-4.4.1.0,
base-4.4.0.0, base-4.3.1.0, base-4.3.0.0, base-4.2.0.2, base-4.2.0.1,
base-4.2.0.0, base-4.1.0.0, base-4.0.0.0, base-3.0.3.2, base-3.0.3.1
(constraint from non-upgradeable package requires installed instance)
[__2] fail (backjumping, conflict set: base, liquid-base)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, liquid-base, mergesort

This is after removing base as a dependency in my .cabal files.

» cat mergesort.cabal | grep base
      liquid-base >=4.15.0
      liquid-base >=4.15.0
      liquid-base >=4.15.0

Building with stack did not work for me at this point. See #1886 for details.

@wjrforcyber
Copy link
Author

wjrforcyber commented Oct 22, 2021

Try building with stack instead of cabal. I got mine working after removing the dependency on base in the .cabal file and building with stack.

Could you please show me the exact version of ghc, cabal you used building the liquidhaskell, if stack works, then when version specified in the .cabal file, cabal should work, too.

Is it still what you mentioned above : ghc 8.10.2 with cabal 3.2.0.0 ?

@aavogt
Copy link

aavogt commented Oct 24, 2021

I encountered the same problem on macOS 11.6. After making a fresh clone of the lh-plugin-demo repo and switching to ghc 8.10.2 with cabal 3.2.0.0, I got the following error when executing cabal v2-build:

src/Language/Haskell/Liquid/UX/Annotate.hs:446:31: error:
    • Couldn't match expected type ‘Key’ with actual type ‘T.Text’
    • In the first argument of ‘(.=)’, namely ‘tshow k’
      In the expression: tshow k .= toJSON a
      In the first argument of ‘object’, namely
        ‘[tshow k .= toJSON a | (k, a) <- M.toList kas]’
    |
446 |   toJSON (Asc kas) = object [ tshow k .= toJSON a | (k, a) <- M.toList kas ]
    |                               ^^^^^^^
cabal: Failed to build liquidhaskell-0.8.10.2.1 (which is required by
lh-plugin-demo-0.1.0.0).

I had this too. It can be fixed by updating the cabal.project

packages: .

source-repository-package
    type: git
    location: https://github.com/ucsd-progsys/liquidhaskell
    tag: 28a6b51491164f5480778a50f6d83b0f110bfd81


source-repository-package
    type: git
    location: https://github.com/ucsd-progsys/liquidhaskell
    tag: 28a6b51491164f5480778a50f6d83b0f110bfd81
    subdir: liquid-base

source-repository-package
    type: git
    location: https://github.com/ucsd-progsys/liquidhaskell
    tag: 28a6b51491164f5480778a50f6d83b0f110bfd81
    subdir: liquid-ghc-prim

source-repository-package
    type: git
    location: https://github.com/ucsd-progsys/liquidhaskell
    tag: 28a6b51491164f5480778a50f6d83b0f110bfd81
    subdir: liquid-prelude

source-repository-package
    type: git
    location: https://github.com/ucsd-progsys/liquid-fixpoint
    tag: 8210e417b811655b07db8280037f3bcdb5cbd0cd

@yiwei-w
Copy link

yiwei-w commented Oct 26, 2021

Try building with stack instead of cabal. I got mine working after removing the dependency on base in the .cabal file and building with stack.

Could you please show me the exact version of ghc, cabal you used building the liquidhaskell, if stack works, then when version specified in the .cabal file, cabal should work, too.

Is it still what you mentioned above : ghc 8.10.2 with cabal 3.2.0.0 ?

I am using ghc 8.10.2 with cabal 3.4.1.0.

@not-much-io
Copy link

I have this same issue. I have a controlled docker environment so I reduced the unrelated cruft a bit and can supply it here as a reproduction case:

FROM ubuntu:jammy

###
### Setup a standard user, no root funny business
###
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
    && apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
    #
    # Verify git, needed tools installed
    && apt-get -y install git iproute2 procps lsb-release lldb curl build-essential curl libffi-dev libffi7 libgmp-dev libgmp10 libncurses-dev libncurses5 libtinfo5 \
    #
    # Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
    && groupadd --gid $USER_GID $USERNAME \
    && useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
    #
    # [Optional] Add sudo support for the non-root user
    && apt-get install -y sudo \
    && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\
    && chmod 0440 /etc/sudoers.d/$USERNAME
USER ${USERNAME}
ENV DEBIAN_FRONTEND=dialog

###
### Install haskell toolchain
###
ENV GHC_VERSION=8.10.2
ENV CABAL_VERSION=3.2.0.0
RUN curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | \
    BOOTSTRAP_HASKELL_NONINTERACTIVE=1 BOOTSTRAP_HASKELL_MINIMAL=1 sh
ENV PATH=/home/vscode/.ghcup/bin:${PATH}
RUN ghcup install ghc ${GHC_VERSION} && ghcup set ghc ${GHC_VERSION}
RUN ghcup install cabal ${CABAL_VERSION}

RUN cabal update
WORKDIR /home/vscode/repro
RUN cabal init \
    && sed -i "s/build-depends:       base >=4.14 && <4.15/build-depends: liquid-base, liquidhaskell >= 0.8.10/" repro.cabal \
    && printf "\n  ghc-options: -fplugin=LiquidHaskell\n" >> repro.cabal \
    && cat repro.cabal
RUN cabal v2-build

In case of unfamiliarity with docker but still interested:

  1. Install docker
  2. Put the above file content in a file called Dockerfile in a otherwise clean dir
  3. Run docker build . in the dir

Should get this issue:

#12 526.5 
#12 526.5 src/Language/Haskell/Liquid/UX/Annotate.hs:446:31: error:
#12 526.5     * Couldn't match expected type `Key' with actual type `T.Text'
#12 526.5     * In the first argument of `(.=)', namely `tshow k'
#12 526.5       In the expression: tshow k .= toJSON a
#12 526.5       In the first argument of `object', namely
#12 526.5         `[tshow k .= toJSON a | (k, a) <- M.toList kas]'
#12 526.5     |
#12 526.5 446 |   toJSON (Asc kas) = object [ tshow k .= toJSON a | (k, a) <- M.toList kas ]
#12 526.5     |                               ^^^^^^^
#12 526.5 cabal: Failed to build liquidhaskell-0.8.10.2 (which is required by exe:repro
#12 526.5 from repro-0.1.0.0). See the build log above for details.
#12 526.5 

Should it matter (really shouldn't though):

  • Host OS is NAME=NixOS, VERSION="21.05.4442.b86b6bc5e75 (Okapi)"
  • Host Linux Kernel 5.10.81
  • Docker version 20.10.7, build v20.10.7

@facundominguez
Copy link
Collaborator

Hello!

Couldn't match expected type Key' with actual type T.Text'

This is an issue that has been fixed in #1884. Building liquidhaskell-0.8.10.7 instead of liquidhaskell-0.8.10.2 might solve that particular error.

@not-much-io
Copy link

I can confirm that editing my reproduction case to explicitly utilize liquidhaskell-0.8.10.7 instead of liquidhaskell-0.8.10 allowed the build to succeed.

...
build-depends:
    base,
    liquidhaskell >= 0.8.10.7

NOTE: My repro case did also need a SMT solver, but that error message was clear. After adding it full success in build.

However I also had to dump liquid-base for base. Because liquid-base-4.14.1.0 (matching GHC 8.10.2) would pull in liquidhaskell-0.8.10.2, which again would fail to build.

So I'm guessing there should actually be a liquid-base-4.14.1.1 release that uses liquidhaskell-0.8.10.7 for it to work with GHC 8.10.2? Just an observation if that kind of usecase is intended to be supported.

For me I'm fine to continue my academic experimenting without liquid-base for now, but If I can help test something feel free to ping me here.

Thanks for the tip @facundominguez !

@not-much-io
Copy link

Oh, I actually didn't realize I needed liquid-base for the purposes of the prelude types within actually working with liquidhaskell. (as I understood it)

So in the end I just bumped the versions:

ENV GHC_VERSION=9.0.1
ENV CABAL_VERSION=3.6.0

And everything works due to the new liquid-base no longer pulling in liquidhaskell-0.8.10.3 version.

I have a fresh project but the reason I was still hesitant to go to GHC9 was tooling.

@ranjitjhala
Copy link
Member

ranjitjhala commented Dec 8, 2021 via email

@facundominguez
Copy link
Collaborator

I'm closing this since liquidhaskell moved to GHC 9 now. But please feel free to reach out again if there are more installation troubles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants