I'm trying to build some Haskell packages with stack
(haskell-ide-engine
and hlint
specifically), but they both fail with many ld.lld
error messages, all related to R_X86_64_32S
relocation, e.g.:
ld.lld: error: can't create dynamic relocation R_X86_64_32S against symbol: stg_bh_upd_frame_info in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output
>>> defined in /home/kas/.stack/programs/x86_64-linux/ghc-tinfo6-8.6.5/lib/ghc-8.6.5/rts/libHSrts_thr.a(Updates.thr_o)
>>> referenced by /home/kas/.stack/setup-exe-src/setup-shim-mPHDZzAJ.o:(s6WS_info)
I tried configuring stack
to use a different linker (using ghc-options
flags), but I can't get that to work, and it always uses lld
.
Does anyone know how I can change stack
's linker, or fix the error some other way?
Thanks!
See this answer in stack
's own FAQ!