Skip to content

Stack picks up the wrong compiler when using stack init --solver #1529

@harendra-kumar

Description

@harendra-kumar

stack is setup to use ghc-7.8.4 from lts-2.22

cueball:/vol/hosts/cueball/workspace/halberd$ stack exec which ghc
Run from outside a project, using implicit global project config
Using resolver: lts-2.22 from implicit global project's config file: /var/home/harendra/.stack/global-project/stack.yaml
/var/home/harendra/.stack/programs/x86_64-linux/ghc-7.8.4/bin/ghc

But cabal invoked by stack init --solver is picking up the one which is in the user path:

cueball:/vol/hosts/cueball/workspace/halberd$ stack init --solver
Writing default config file to: /vol/hosts/cueball/workspace/halberd/stack.yaml
Basing on cabal files:
- /vol/hosts/cueball/workspace/halberd/halberd.cabal

Asking cabal to calculate a build plan, please wait
Running /var/home/harendra/.local/bin/cabal --config-file=/tmp/cabal-solver6697/cabal.config install --enable-tests --enable-benchmarks -v --dry-run --only-dependencies --reorder-goals --max-backjumps=-1 --package-db=clear --package-db=global /vol/hosts/cueball/workspace/halberd/ exited with ExitFailure 1
/var/home/harendra/.stack/snapshots/x86_64-linux/lts-3.14/7.10.2/bin/cpphs --version
/usr/bin/gcc -dumpversion
/var/home/harendra/.stack/programs/x86_64-linux/ghc-7.10.2/bin/haddock --version
/var/home/harendra/.stack/snapshots/x86_64-linux/lts-3.14/7.10.2/bin/happy --version
/var/home/harendra/.stack/programs/x86_64-linux/ghc-7.10.2/bin/hpc version
looking for tool hsc2hs near compiler in
/var/home/harendra/.stack/programs/x86_64-linux/ghc-7.10.2/bin
found hsc2hs in
/var/home/harendra/.stack/programs/x86_64-linux/ghc-7.10.2/bin/hsc2hs
/var/home/harendra/.stack/programs/x86_64-linux/ghc-7.10.2/bin/hsc2hs --version
/var/home/harendra/.stack/snapshots/x86_64-linux/lts-3.14/7.10.2/bin/HsColour -version
/var/home/harendra/.stack/programs/x86_64-linux/ghc-7.10.2/bin/ghc -c /tmp/1804289383846930886.c -o /tmp/16816927771714636915.o
/usr/bin/ld -x -r /tmp/16816927771714636915.o -o /tmp/1957747793424238335.o
/usr/bin/pkg-config --version
/bin/tar --help
Reading available packages...
Updating the index cache file...
Choosing modular solver.
Resolving dependencies...

cabal: Could not resolve dependencies:
trying: halberd-0.1.2.9 (user goal)
next goal: base (dependency of halberd-0.1.2.9)
rejecting: base-4.8.1.0/installed-4f7... (conflict: halberd => base>=4.5 &&
<4.8)
rejecting: base-4.8.1.0, 4.8.0.0, 4.7.0.2, 4.7.0.1, 4.7.0.0, 4.6.0.1, 4.6.0.0,
4.5.1.0, 4.5.0.0, 4.4.1.0, 4.4.0.0, 4.3.1.0, 4.3.0.0, 4.2.0.2, 4.2.0.1,
4.2.0.0, 4.1.0.0, 4.0.0.0, 3.0.3.2, 3.0.3.1 (global constraint requires
installed instance)
Dependency tree exhaustively searched.

We can see 7.10.2 being picked up above and solver failing because of incompatible base package. Perhaps cabal is not being called with modified environment.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions