koalag
koalag

Reputation: 143

Stack: how to build with lts-13.2? I want to use newer libraries

I am using stack for some of my Haskell projects. Up until now, I was having no trouble; but since lts-13.1 I get a weird built error.

When I setup up a new project with stack new foo && cd foo, and then run stack setup --ghc-build standard, I get this huge repetitive error message:

/usr/bin/ld.gold: error: /home/georg/.stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/rts/libHSrts_thr.a(Interpreter.thr_o): requires unsupported dynamic reloc 11; recompile with -fPIC
/usr/bin/ld.gold: error: /home/georg/.stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/rts/libHSrts_thr.a(CheckUnload.thr_o): requires unsupported dynamic reloc 11; recompile with -fPIC
/usr/bin/ld.gold: error: /home/georg/.stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/rts/libHSrts_thr.a(CheckUnload.thr_o): requires dynamic R_X86_64_32 reloc against 'linker_unloaded_mutex' which may overflow at runtime; recompile with -fPIC
/usr/bin/ld.gold: error: /home/georg/.stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/rts/libHSrts_thr.a(Scav.thr_o): requires unsupported dynamic reloc 11; recompile with -fPIC
/usr/bin/ld.gold: error: /home/georg/.stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/rts/libHSrts_thr.a(Scav.thr_o): requires unsupported dynamic reloc 11; recompile with -fPIC
/usr/bin/ld.gold: error: /home/georg/.stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/rts/libHSrts_thr.a(Scav.thr_o): requires unsupported dynamic reloc 11; recompile with -fPIC
/usr/bin/ld.gold: error: /home/georg/.stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/rts/libHSrts_thr.a(Scav.thr_o): requires unsupported dynamic reloc 11; recompile with -fPIC
/usr/bin/ld.gold: error: /home/georg/.stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/rts/libHSrts_thr.a(Scav.thr_o): requires unsupported dynamic reloc 11; recompile with -fPIC
/usr/bin/ld.gold: error: /home/georg/.stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/rts/libHSrts_thr.a(Scav.thr_o): requires unsupported dynamic reloc 11; recompile with -fPIC
/usr/bin/ld.gold: error: /home/georg/.stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/rts/libHSrts_thr.a(Compact.thr_o): requires unsupported dynamic reloc 11; recompile with -fPIC
/usr/bin/ld.gold: error: /home/georg/.stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/rts/libHSrts_thr.a(Compact.thr_o): requires unsupported dynamic reloc 11; recompile with -fPIC
/usr/bin/ld.gold: error: /home/georg/.stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/rts/libHSrts_thr.a(Compact.thr_o): requires dynamic R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC
/usr/bin/ld.gold: error: /home/georg/.stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/rts/libHSrts_thr.a(Evac_thr.thr_o): requires dynamic R_X86_64_32 reloc against 'stg_WHITEHOLE_info' which may overflow at runtime; recompile with -fPIC
/usr/bin/ld.gold: error: /home/georg/.stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/rts/libHSrts_thr.a(Evac_thr.thr_o): requires dynamic R_X86_64_32 reloc against 'stg_WHITEHOLE_info' which may overflow at runtime; recompile with -fPIC
/usr/bin/ld.gold: error: /home/georg/.stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/rts/libHSrts_thr.a(MarkWeak.thr_o): requires unsupported dynamic reloc 11; recompile with -fPIC
/usr/bin/ld.gold: error: /home/georg/.stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/rts/libHSrts_thr.a(MarkWeak.thr_o): requires unsupported dynamic reloc 11; recompile with -fPIC
/usr/bin/ld.gold: error: /home/georg/.stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/rts/libHSrts_thr.a(MarkWeak.thr_o): requires dynamic R_X86_64_32 reloc which may overflow at runtime; recompile with -fPIC
/usr/bin/ld.gold: error: /home/georg/.stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/rts/libHSrts_thr.a(Evac.thr_o): requires unsupported dynamic reloc 11; recompile with -fPIC
/usr/bin/ld.gold: error: /home/georg/.stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/rts/libHSrts_thr.a(Evac.thr_o): requires dynamic R_X86_64_32 reloc against 'stg_WHITEHOLE_info' which may overflow at runtime; recompile with -fPIC
/usr/bin/ld.gold: error: /home/georg/.stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/rts/libCffi.a(ffi64.o): requires unsupported dynamic reloc 11; recompile with -fPIC
/usr/bin/ld.gold: error: /home/georg/.stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/rts/libCffi.a(unix64.o): requires dynamic R_X86_64_PC32 reloc against 'abort' which may overflow at runtime; recompile with -fPIC
/usr/bin/ld.gold: error: /home/georg/.stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/rts/libCffi.a(ffiw64.o): requires dynamic R_X86_64_32 reloc against 'ffi_closure_win64' which may overflow at runtime; recompile with -fPIC

...hundreds more of the same...

/usr/bin/ld.gold: error: /home/georg/.stack/programs/x86_64-linux/ghc-8.6.3/lib/ghc-8.6.3/rts/libCffi.a(win64.o): requires dynamic R_X86_64_PC32 reloc against 'abort' which may overflow at runtime; recompile with -fPIC
clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
`clang' failed in phase `Linker'. (Exit code: 1)

--  While building simple Setup.hs using:
      /home/georg/.stack/programs/x86_64-linux/ghc-8.6.3/bin/ghc -rtsopts -threaded -clear-package-db -global-package-db -hide-all-packages -package base -main-is StackSetupShim.mainOverride -package Cabal-2.4.0.1 /home/georg/.stack/setup-exe-src/setup-mPHDZzAJ.hs /home/georg/.stack/setup- 
   exe-src/setup-shim-mPHDZzAJ.hs -o /home/georg/.stack/setup-exe-cache/x86_64- 
   linux/tmp-Cabal-simple_mPHDZzAJ_2.4.0.1_ghc-8.6.3
    Process exited with code: ExitFailure 1

I think this has something to do with lts-13.1/2 or my Arch Linux/gcc installation, because when I change resolver: lts-13.2 to resolver: lts-12.4 in stack.yaml, it builds fine.

I tried different options for --ghc-build to no avail; switched between clang and gcc; all my stack and other local Haskell packages are up to date (I'm on Arch Linux).

I want to use the latest version of Megaparsec 7.0.4, which is not part of lt-12.4 (version 6.5). I can work around this problem with dependency options in stack/cabal, but I wonder why not even an empty/new project won't build with lts-13.2 on my machine (lts-13.1 won't work either). This problem is very similiar to mine, but none the solutions presented there work for me.

What am I missing?

Upvotes: 2

Views: 292

Answers (1)

koalag
koalag

Reputation: 143

Apparently, this is a re-emergence of an old problem: https://github.com/commercialhaskell/stack/issues/4497

Seems some config tool sets ("C compiler supports -no-pie", "NO") in ~/.stack/programs/x86_64-linux/ghc-tinfo6-8.6.3/lib/ghc-8.6.3/settings wrongly; changing this manually to YES will let me build my project.

So this problem is apparently a bug in one of the generator tools stack uses. Mind this is a "hotfix"; follow the issue on Github with the link I provided to stay up to date.

Upvotes: 2

Related Questions