Skip to content

Stack is using a different version of cabal to install extra-deps packages #2924

@carliros

Description

@carliros

Hello,

I am trying to use a custom cabal build for my project. I am trying to use uuagc and uuagc-cabal to pre-process my AG files to generate HS files. But, I am facing some issues with stack and uuagc-cabal.
Looks like stack is installing uuagc-cabal with a different version of cabal in relation to the cabal version that my project is using and the problem is when I try to use uuagc-cabal library in Setup.hs of my project where I have two different versions of cabal. Here is the logs with the error I am seeing:

squirrel:hello-uuagc carlos$ stack setup
Fetched package index.
Populated index cache.
Preparing to install GHC to an isolated location.
This will not interfere with any system-level installation.
Downloaded ghc-8.0.1.
Installed GHC.
stack will use a sandboxed GHC it installed
For more information on paths, see 'stack path' and 'stack exec env'
To use this GHC and packages outside of a project, consider using:
stack ghc, stack ghci, stack runghc, or stack exec
squirrel:hello-uuagc carlos$ stack build
[1 of 2] Compiling Main             ( /Users/carlos/.stack/setup-exe-src/setup-mPHDZzAJ.hs, /Users/carlos/.stack/setup-exe-src/setup-mPHDZzAJ.o )
[2 of 2] Compiling StackSetupShim   ( /Users/carlos/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /Users/carlos/.stack/setup-exe-src/setup-shim-mPHDZzAJ.o )
Linking /Users/carlos/.stack/setup-exe-cache/x86_64-osx/tmp-Cabal-simple_mPHDZzAJ_1.24.0.0_ghc-8.0.1 ...
text-1.2.2.1: download
mtl-2.2.1: download
Cabal-1.24.2.0: download
old-locale-1.0.0.7: download
old-locale-1.0.0.7: configure
old-locale-1.0.0.7: build
mtl-2.2.1: configure
mtl-2.2.1: build
text-1.2.2.1: configure
old-locale-1.0.0.7: copy/register
text-1.2.2.1: build
Cabal-1.24.2.0: configure
old-time-1.1.0.3: download
Cabal-1.24.2.0: build
old-time-1.1.0.3: configure
mtl-2.2.1: copy/register
happy-1.19.5: download
old-time-1.1.0.3: build
happy-1.19.5: configure
happy-1.19.5: build
old-time-1.1.0.3: copy/register
uulib-0.9.22: download
uulib-0.9.22: configure
uulib-0.9.22: build
uulib-0.9.22: copy/register
happy-1.19.5: copy/register
text-1.2.2.1: copy/register
polyparse-1.12: download
polyparse-1.12: configure
polyparse-1.12: build
polyparse-1.12: copy/register
cpphs-1.20.2: download
cpphs-1.20.2: configure
cpphs-1.20.2: build
cpphs-1.20.2: copy/register
haskell-src-exts-1.17.1: download
haskell-src-exts-1.17.1: configure
haskell-src-exts-1.17.1: build
Cabal-1.24.2.0: copy/register
uuagc-cabal-1.0.6.0: download
uuagc-cabal-1.0.6.0: configure
uuagc-cabal-1.0.6.0: build
uuagc-cabal-1.0.6.0: copy/register
haskell-src-exts-1.17.1: copy/register
uuagc-0.9.52.1: download
uuagc-0.9.52.1: configure
uuagc-0.9.52.1: build
uuagc-0.9.52.1: copy/register
hello-uuagc-0.1.0.0: configure (exe)
[1 of 2] Compiling Main             ( /Users/carlos/Documents/development/research/hello-uuagc/Setup.hs, /Users/carlos/Documents/development/research/hello-uuagc/.stack-work/dist/x86_64-osx/Cabal-1.24.0.0/setup/Main.o )

/Users/carlos/Documents/development/research/hello-uuagc/Setup.hs:5:30: error:
    • Couldn't match expected type ‘UserHooks’
                  with actual type ‘Cabal-1.24.2.0:Distribution.Simple.UserHooks.UserHooks’
      NB: ‘Cabal-1.24.2.0:Distribution.Simple.UserHooks.UserHooks’
            is defined in ‘Distribution.Simple.UserHooks’
                in package ‘Cabal-1.24.2.0’
          ‘UserHooks’
            is defined in ‘Distribution.Simple.UserHooks’
                in package ‘Cabal-1.24.0.0’
    • In the first argument of ‘defaultMainWithHooks’, namely
        ‘(uuagcLibUserHook uuagc)’
      In the expression: defaultMainWithHooks (uuagcLibUserHook uuagc)
      In an equation for ‘main’:
          main = defaultMainWithHooks (uuagcLibUserHook uuagc)
Completed 13 action(s).

--  While building package hello-uuagc-0.1.0.0 using:
      /Users/carlos/.stack/programs/x86_64-osx/ghc-8.0.1/bin/ghc --make -odir /Users/carlos/Documents/development/research/hello-uuagc/.stack-work/dist/x86_64-osx/Cabal-1.24.0.0/setup -hidir /Users/carlos/Documents/development/research/hello-uuagc/.stack-work/dist/x86_64-osx/Cabal-1.24.0.0/setup -i -i. -clear-package-db -global-package-db -package-db=/Users/carlos/.stack/snapshots/x86_64-osx/lts-7.15/8.0.1/pkgdb -package-db=/Users/carlos/Documents/development/research/hello-uuagc/.stack-work/install/x86_64-osx/lts-7.15/8.0.1/pkgdb -hide-all-packages -package=Cabal-1.24.0.0 -package-id=array-0.5.1.1 -package-id=base-4.9.0.0 -package-id=binary-0.8.3.0 -package-id=bytestring-0.10.8.1 -package-id=containers-0.5.7.1 -package-id=deepseq-1.4.2.0 -package-id=directory-1.2.6.2 -package-id=filepath-1.4.1.0 -package-id=ghc-boot-8.0.1 -package-id=ghc-boot-th-8.0.1 -package-id=ghc-prim-0.5.0.0 -package-id=ghci-8.0.1 -package-id=haskeline-0.7.2.3 -package-id=hoopl-3.10.2.1 -package-id=hpc-0.6.0.3 -package-id=integer-gmp-1.0.0.1 -package-id=pretty-1.1.3.3 -package-id=process-1.4.2.0 -package-id=rts -package-id=template-haskell-2.11.0.0 -package-id=terminfo-0.4.0.2 -package-id=time-1.6.0.1 -package-id=transformers-0.5.2.0 -package-id=unix-2.7.2.0 -package-id=uuagc-0.9.52.1-IIwyYC9tdGhA1gPRBZkcWJ -package-id=uuagc-cabal-1.0.6.0-G8DOi0EgyIL1on8rRTcIWG -package-id=xhtml-3000.2.1 /Users/carlos/Documents/development/research/hello-uuagc/Setup.hs /Users/carlos/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs -main-is StackSetupShim.mainOverride -o /Users/carlos/Documents/development/research/hello-uuagc/.stack-work/dist/x86_64-osx/Cabal-1.24.0.0/setup/setup -threaded
    Process exited with code: ExitFailure 1

I wonder if we have a way to make stack use the same version of cabal for installing extra-deps packages.

The version of stack is:

Version 1.3.2, Git revision 3f675146590da4f3edf768b89355f798229da2a5 (4395 commits) x86_64 hpack-0.15.0

Here is my stack.yaml

# This file was automatically generated by 'stack init'
#
# Some commonly used options have been documented as comments in this file.
# For advanced use and comprehensive documentation of the format, please see:
# http://docs.haskellstack.org/en/stable/yaml_configuration/

# Resolver to choose a 'specific' stackage snapshot or a compiler version.
# A snapshot resolver dictates the compiler version and the set of packages
# to be used for project dependencies. For example:
#
# resolver: lts-3.5
# resolver: nightly-2015-09-21
# resolver: ghc-7.10.2
# resolver: ghcjs-0.1.0_ghc-7.10.2
# resolver:
#  name: custom-snapshot
#  location: "./custom-snapshot.yaml"
resolver: lts-7.15

# User packages to be built.
# Various formats can be used as shown in the example below.
#
# packages:
# - some-directory
# - https://example.com/foo/bar/baz-0.0.2.tar.gz
# - location:
#    git: https://github.com/commercialhaskell/stack.git
#    commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
# - location: https://github.com/commercialhaskell/stack/commit/e7b331f14bcffb8367cd58fbfc8b40ec7642100a
#   extra-dep: true
#  subdirs:
#  - auto-update
#  - wai
#
# A package marked 'extra-dep: true' will only be built if demanded by a
# non-dependency (i.e. a user package), and its test suites and benchmarks
# will not be run. This is useful for tweaking upstream packages.
packages:
- '.'
# Dependency packages to be pulled from upstream that are not in the resolver
# (e.g., acme-missiles-0.3)
extra-deps:
- uuagc-0.9.52.1
- uulib-0.9.22
- uuagc-cabal-1.0.6.0

# Override default flag values for local packages and extra-deps
flags: {}

# Extra package databases containing global packages
extra-package-dbs: []

explicit-setup-deps:
  "*": true

# Control whether we use the GHC we find on the path
# system-ghc: true
#
# Require a specific version of stack, using version ranges
# require-stack-version: -any # Default
# require-stack-version: ">=1.2"
#
# Override the architecture used by stack, especially useful on Windows
# arch: i386
# arch: x86_64
#
# Extra directories used by stack for building
# extra-include-dirs: [/path/to/dir]
# extra-lib-dirs: [/path/to/dir]
#
# Allow a newer minor version of GHC than the snapshot specifies
# compiler-check: newer-minor

And here is my cabal file:

name:                hello-uuagc
version:             0.1.0.0
synopsis:            Simple project template from stack
description:         Please see README.md
homepage:            https://github.com/githubuser/hello-uuagc#readme
license:             BSD3
license-file:        LICENSE
author:              Author name here
maintainer:          [email protected]
copyright:           2017 Author name here
category:            Web
build-type:          Custom
cabal-version:       >=1.10
extra-source-files:  uuagc_options, src/Test.ag

executable hello-uuagc
  hs-source-dirs:      src
  main-is:             Main.hs
  default-language:    Haskell2010
  build-depends:       base >= 4.7 && < 5,
                       uuagc, uuagc-cabal

And here is my Setup.hs file

import Distribution.Simple
import Distribution.Simple.UUAGC (uuagcLibUserHook)
import UU.UUAGC (uuagc)

main = defaultMainWithHooks (uuagcLibUserHook uuagc)

I would appreciate some help, thx in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions