Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Haskell Stack doesn't use system Ghc

I'm trying to use Haskell Stack to setup a project but using the stack provided ghc I am having a -fPIC error GitHub issue

To bypass the fPIC problem I'm trying to use a package manager provided GHC using the 7.10.3 version (stack currently is using 8.0.2)

When I try to force stack to use the systm ghc it simply ignores me. I've tried to override using /home/user/.stack/config.yaml and {project}/stack.yaml system-ghc : true option... but stack use the 8.0.2 version in the setup.

Am I missing something?

TL;DR

Stack ignore the system-ghc : true option

I'm runnig Sabayon 16


"haskell-primer" is the project name

stack list-dependencies

base 4.9.1.0
ghc-prim 0.5.0.0
haskell-primer 0.1.0.0
integer-gmp 1.0.0.1
rts 1.0
like image 928
Stefano Cerruti Avatar asked Jun 09 '17 14:06

Stefano Cerruti


1 Answers

Setting system-ghc: true allows Stack to use the system GHC if it matches the resolver's constraints. It will not force Stack to use the system GHC if it does not match the constraints. If your resolver requires GHC 8 but your system has GHC 7 then Stack will not use your system GHC no matter what value you give system-ghc. Conversely, if system-ghc: false then Stack will never use the system GHC, regardless of whether its version matches.

From the Stack FAQ, emphasis mine:

If you would like stack to use your system GHC installation, use the --system-ghc flag or run stack config set system-ghc --global true to make stack check your PATH for a suitable GHC by default.

Note that stack can only use a system GHC installation if its version is compatible with the configuration of the current project, particularly the resolver setting.

like image 189
Rein Henrichs Avatar answered Oct 01 '22 11:10

Rein Henrichs