Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build issue on Stackage LTS 7.4 (GHC 8.0.1) on Ubuntu Yakkety #43

Closed
korayal opened this issue Oct 17, 2016 · 10 comments
Closed

Build issue on Stackage LTS 7.4 (GHC 8.0.1) on Ubuntu Yakkety #43

korayal opened this issue Oct 17, 2016 · 10 comments
Assignees

Comments

@korayal
Copy link

korayal commented Oct 17, 2016

It seems I can't build this project using Stackage LTS 7.4, which causes me to fail building other projects that use this specific library (Tasty). Here is what I did:

stack init

Looking for .cabal or package.yaml files to use to init the project.
Using cabal packages:
- clock.cabal

Selecting the best among 9 snapshots...

* Matches lts-7.4

Selected resolver: lts-7.4
Initialising configuration using resolver: lts-7.4
Total number of user packages considered: 1
Writing configuration to file: stack.yaml
All done.

stack build

clock-0.7.2: configure (lib)
Configuring clock-0.7.2...
clock-0.7.2: build (lib)
Preprocessing library clock-0.7.2...
Clock.hsc:44:0: warning: "hsc_alignment" redefined
In file included from .stack-work/dist/x86_64-linux-nopie/Cabal-1.24.0.0/build/System/Clock_hsc_make.c:1:0:
/home/korayal/.stack/programs/x86_64-linux/ghc-nopie-8.0.1/lib/ghc-8.0.1/template-hsc.h:88:0: note: this is the location of the previous definition
 #define hsc_alignment(t...) \

/usr/bin/ld: .stack-work/dist/x86_64-linux-nopie/Cabal-1.24.0.0/build/System/Clock_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-nopie/Cabal-1.24.0.0/build/System/Clock_hsc_make.o failed (exit code 1)
command was: /usr/bin/gcc .stack-work/dist/x86_64-linux-nopie/Cabal-1.24.0.0/build/System/Clock_hsc_make.o .stack-work/dist/x86_64-linux-nopie/Cabal-1.24.0.0/build/System/Clock_hsc_utils.o -o .stack-work/dist/x86_64-linux-nopie/Cabal-1.24.0.0/build/System/Clock_hsc_make -fno-PIE -fno-stack-protector -L/home/korayal/.stack/programs/x86_64-linux/ghc-nopie-8.0.1/lib/ghc-8.0.1/base-4.9.0.0 -Wl,-R,/home/korayal/.stack/programs/x86_64-linux/ghc-nopie-8.0.1/lib/ghc-8.0.1/base-4.9.0.0 -L/home/korayal/.stack/programs/x86_64-linux/ghc-nopie-8.0.1/lib/ghc-8.0.1/integer-gmp-1.0.0.1 -Wl,-R,/home/korayal/.stack/programs/x86_64-linux/ghc-nopie-8.0.1/lib/ghc-8.0.1/integer-gmp-1.0.0.1 -lgmp -L/home/korayal/.stack/programs/x86_64-linux/ghc-nopie-8.0.1/lib/ghc-8.0.1/ghc-prim-0.5.0.0 -Wl,-R,/home/korayal/.stack/programs/x86_64-linux/ghc-nopie-8.0.1/lib/ghc-8.0.1/ghc-prim-0.5.0.0 -L/home/korayal/.stack/programs/x86_64-linux/ghc-nopie-8.0.1/lib/ghc-8.0.1/rts -Wl,-R,/home/korayal/.stack/programs/x86_64-linux/ghc-nopie-8.0.1/lib/ghc-8.0.1/rts -lm -lrt -ldl

--  While building package clock-0.7.2 using:
      /home/korayal/.stack/setup-exe-cache/x86_64-linux-nopie/Cabal-simple_qDiHe4NR_1.24.0.0_ghc-8.0.1 --builddir=.stack-work/dist/x86_64-linux-nopie/Cabal-1.24.0.0 build lib:clock --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1
@korayal
Copy link
Author

korayal commented Oct 17, 2016

adding cc-options: -fPIC to the cabal file seems to fix the issue on my end. But I'm not sure if it'll cause any problems on older versions of GCC.

@rbasso
Copy link

rbasso commented Oct 26, 2016

I cannot reproduce the problem in Debian Stable (jessie) - with stack 1.2.0 or from master - but I have exactly the same problem in Debian Unstable (sid) running stack from master (cannot test with stack 1.2.0).

Setting cc-options: -fPIC also worked for me.

The problem seems restricted to stack snapshots using GHC 8.0.1 (>= lts-7.0 || >= nightly-2016-05-26).

Possibly related to commercialhaskell/stack#2712.

@rbasso
Copy link

rbasso commented Oct 26, 2016

Package digest seems to suffer from the exactly same problem. I bet there are other packages...

Not sure where this should be fixed.

@CetinSert
Copy link
Member

So should I just add that cc-options: -fPIC to clock.cabal now?

@CetinSert CetinSert self-assigned this Oct 27, 2016
@rbasso
Copy link

rbasso commented Oct 27, 2016

Considering that there are other packages displaying the same problem, I would wait until the cause is clearer before changing anything, @CetinSert. Maybe this has to be fixed elsewhere.

@korayal
Copy link
Author

korayal commented Nov 29, 2016

This issue seems to be fixed when this specific version is used instead of previous GHC 8.0.1 versions:

http://downloads.haskell.org/~ghc/8.0.2-rc1/ghc-8.0.1.20161117-x86_64-deb8-linux.tar.xz

@simonmichael
Copy link

Hi, we have hit this recently when building the clock package for hledger on Arch Linux. Does anyone know the cause/proper fix for it ?

@simonmichael
Copy link

PS, using ghc 8.0.2. Issue: simonmichael/hledger#668

@CetinSert
Copy link
Member

@simonmichael so is this fixed with -no-pie?

@simonmichael
Copy link

Yes, apparently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants