Skip to content

stack setup does not use gcc specified with "with-gcc" #5493

@BebeSparkelSparkel

Description

@BebeSparkelSparkel

General summary/comments (optional)

expect to be able to specify the gcc path to be used with with-gcc in config.yaml and have stack setup --verbose use that version when adding a binary-dis of ghc.

Steps to reproduce

  1. Ensure that there is a gcc version less than 4.4 in PATH. `
$ gcc --version
gcc (GCC) 4.2.1 20070719
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  1. Have a binary distribution on file and list it in config.yaml
# example config.yaml entry
setup-info:
  ghc:
    openbsd64-maj6-min7:
      8.8.1:
        url: '/home/user/ghc/ghc-8.8.1-x86_64-unknown-openbsd.tar.xz'
  1. Add the with-gcc to config.yaml. Example with-gcc: '/usr/local/bin/egcc'
  2. Create a new project stack new different-gcc-; cd different-gcc
  3. Add compiler: ghc-8.8.1 to the project's stack.yaml
  4. run stack setup --version

~/.stack/config.yaml

setup-info:
  ghc:
    openbsd64-maj6-min7:
      8.8.1:
        url: '/home/wjr/repos/ghc/ghc-8.8.1-x86_64-unknown-openbsd.tar.xz'
with-gcc: '/usr/local/bin/egcc'

different-gcc-version/stack.yaml

resolver: lts-14.27
compiler: ghc-8.8.1
packages:
- .

Expected

I expected stack to use the gcc specified with with-gcc when importing a new ghc distribution.

Actual

Stack continues to use the gcc that it finds in PATH

$ stack setup --verbose
...
2021-02-24 10:07:26.701864: [error] configure: error: Need at least gcc version 4.4 (4.7+ recommended)
2021-02-24 10:07:26.770883: [debug] checking version of gcc...
2021-02-24 10:07:26.773779: [error] Received ExitFailure 1 when running
Raw command: /home/wjr/.stack/programs/x86_64-openbsd/ghc-maj6-min7-8.8.1.temp/ghc-8.8.1/configure --prefix=/home/wjr/.stack/programs/x86_64-openbsd/ghc-maj6-min7-8.8.1/
Run from: /home/wjr/.stack/programs/x86_64-openbsd/ghc-maj6-min7-8.8.1.temp/ghc-8.8.1/

2021-02-24 10:07:26.773999: [error] 
Error: Error encountered while configuring GHC with
         /home/wjr/.stack/programs/x86_64-openbsd/ghc-maj6-min7-8.8.1.temp/ghc-8.8.1/configure --prefix=/home/wjr/.stack/programs/x86_64-openbsd/ghc-maj6-min7-8.8.1/
         run in /home/wjr/.stack/programs/x86_64-openbsd/ghc-maj6-min7-8.8.1.temp/ghc-8.8.1/
     
       The following directories may now contain files, but won't be used by stack:
         - /home/wjr/.stack/programs/x86_64-openbsd/ghc-maj6-min7-8.8.1.temp/
         - /home/wjr/.stack/programs/x86_64-openbsd/ghc-maj6-min7-8.8.1/
     
       For more information consider rerunning with --verbose flag
     
Configuring GHC ... 

Stack version

$ stack --version
Version 2.6.0, Git revision 30224e347624f34c9ebbbb444c07339cd123eb4d (8277 commits) PRE-RELEASE x86_64 hpack-0.33.0

Method of installation

stack install compile source

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions