Skip to content

Adding criterion to lts-9.5 causes failure to compile #3448

Description

@leshow

General summary/comments (optional)

I created a new project with stack new randomContent simple it used lts-9.5 I added the bytestrings dependency to my cabal file, coded for a while, stack built fine. I wanted to benchmark my code so I added criterion as a dependency also.

Which causes this error:

>  ~/dev/haskell/haskell-programming-book/randomContent [master] ⚡ stack build
code-page-0.1.3: configure
code-page-0.1.3: build
cassava-0.4.5.1: configure
cassava-0.4.5.1: build
statistics-0.13.3.0: configure
statistics-0.13.3.0: build
cassava-0.4.5.1: copy/register
statistics-0.13.3.0: copy/register
Progress: 3/5
--  While building package code-page-0.1.3 using:
      /home/leshow/.stack/setup-exe-cache/x86_64-linux-tinfo6-nopie/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0 build --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1
    Logs have been written to: /home/leshow/dev/haskell/haskell-programming-book/randomContent/.stack-work/logs/code-page-0.1.3.log

    Configuring code-page-0.1.3...
    Building code-page-0.1.3...
    Preprocessing library code-page-0.1.3...
    /usr/bin/ld: .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/System/Win32/CodePage_hsc_make.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
    /usr/bin/ld: final link failed: Nonrepresentable section on output
    collect2: error: ld returned 1 exit status
    linking .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/System/Win32/CodePage_hsc_make.o failed (exit code 1)
    command was: /usr/bin/gcc .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/System/Win32/CodePage_hsc_make.o .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/System/Win32/CodePage_hsc_utils.o -o .stack-work/dist/x86_64-linux-tinfo6-nopie/Cabal-1.24.2.0/build/System/Win32/CodePage_hsc_make -fno-PIE -fno-stack-protector -L/home/leshow/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/base-4.9.1.0 -Wl,-R,/home/leshow/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/base-4.9.1.0 -L/home/leshow/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/integer-gmp-1.0.0.1 -Wl,-R,/home/leshow/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/integer-gmp-1.0.0.1 -lgmp -L/home/leshow/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/ghc-prim-0.5.0.0 -Wl,-R,/home/leshow/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/ghc-prim-0.5.0.0 -L/home/leshow/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/rts -Wl,-R,/home/leshow/.stack/programs/x86_64-linux/ghc-tinfo6-nopie-8.0.2/lib/ghc-8.0.2/rts -lm -lrt -ldl -lpthread

Steps to reproduce

For example:

stack new randomContent simple
# add , bytestring, criterion to build-depends
# import Criterion.Main (in my case in another module)
stack build

Include any .yaml configuration if relevant.

name:                randomContent
version:             0.1.0.0
-- synopsis:
-- description:
homepage:            https://github.com/leshow/randomContent#readme
license:             BSD3
license-file:        LICENSE
author:              Evan Cameron
maintainer:          [email protected]
copyright:           MIT
category:            none
build-type:          Simple
cabal-version:       >=1.10
extra-source-files:  README.md

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

stack.yaml is teh default provided by stack new

Expected

I expected the dependency to be resolved without issue

Actual

adding criterion makes the build fail with a linker error,

Stack version

>  ~/dev/haskell/haskell-programming-book/randomContent [master] ⚡ stack --version
Version 1.5.1 x86_64

Method of installation

Installed from arch regular repos, not the AUR. System is up to date.

##Additional

I went back to try and rebuild packages with criterion in them that previously built just fine, I was unable to build them. They all fail on code-page with the -fPIC error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions