[Haskell-cafe] Problems with Stack on Gentoo Linux

Nicola Gigante nicola.gigante at gmail.com
Tue Oct 20 10:19:17 UTC 2015

Hi all

I’m sorry if this is not the right list to ask, I was unsure.

I’m having problems compiling a project with stack on a Gentoo machine.
I only have shell access to the machine, so I don’t have too much info about it,
but the admin assured me that everything is up to date.

I’ve upgraded to the latest stack, but the problem was also present with 0.1.4.
While doing stack build on my project with resolver lts 3.10 I get the following
strange error:

--  While building package transformers-base-0.4.4 using:
      /home/gigabytes/.stack/setup-exe-cache/setup-Simple-Cabal- --builddir=.stack-work/dist/x86_64-linux/Cabal- build --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1
    Logs have been written to: /home/gigabytes/gigabytes.it/.stack-work/logs/transformers-base-0.4.4.log

    Configuring transformers-base-0.4.4...
    Building transformers-base-0.4.4...
    Preprocessing library transformers-base-0.4.4...
    [1 of 1] Compiling Control.Monad.Base ( src/Control/Monad/Base.hs, .stack-work/dist/x86_64-linux/Cabal- )
    src/Control/Monad/Base.hs:22:1: Warning:
        The import of `Data.Monoid' is redundant
          except perhaps to import instances from `Data.Monoid'
        To import instances alone, use: import Data.Monoid()
    src/Control/Monad/Base.hs:24:1: Warning:
        The import of `Control.Applicative' is redundant
          except perhaps to import instances from `Control.Applicative'
        To import instances alone, use: import Control.Applicative()
    .stack-work/dist/x86_64-linux/Cabal- commitBuffer: invalid argument (invalid character)

Note that the warnings are not stopping the compile process themselves, but they somehow trigger the last error which kills the compiler.

Stack is using the system-installed GHC here, which is version 7.10.2 (of course, otherwise stack wouldn’t have selected it).
Maybe the system-wide compiler wasn’t installed properly (I doubt it, since the admin told me
he uses a Gentoo package manager which is written in haskell and everything works well).
So I’ve tried installing a stack-local GHC version, but I get a sanity check error:

The GHC located at /home/gigabytes/.stack/programs/x86_64-linux/ghc-7.10.2/bin/ghc failed to compile a sanity check. Please see:


for more information. Exception was:
Running /home/gigabytes/.stack/programs/x86_64-linux/ghc-7.10.2/bin/ghc /tmp/stack-sanity-check22752/Main.hs -no-user-package-db exited with ExitFailure 1
[1 of 1] Compiling Main             ( /tmp/stack-sanity-check22752/Main.hs, /tmp/stack-sanity-check22752/Main.o )
Linking /tmp/stack-sanity-check22752/Main ...

/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/stack-sanity-check22752/Main.o: relocation R_X86_64_32S against `stg_bh_upd_frame_info' can not be used when making a shared object; recompile with -fPIC
/tmp/stack-sanity-check22752/Main.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status

So to recap:
- The system-wide ghc crashes compiling transformers-base-0.4.4
- The stack-local ghc does not pass a sanity check

On an OS X machine, the project compiles and work very well with the same 
stack and ghc versions and the same LTS, so I suppose this has to do with 

Any ideas?

Thank you,

More information about the Haskell-Cafe mailing list