I'm trying to install GHC with -fPIC support in Fedora.
I've grabbed a source tarball since it seems no binary one has this.
In Build.mk i've changed the quick build type to
ifeq "$(BuildFlavour)" "quick"
SRC_HC_OPTS = -H64m -O0 -fasm -fPIC
GhcStage1HcOpts = -O -fasm -fPIC
GhcStage2HcOpts = -O0 -fasm -fPIC
GhcLibHcOpts = -O -fasm -fPIC
SplitObjs = NO
HADDOCK_DOCS = NO
BUILD_DOCBOOK_HTML = NO
BUILD_DOCBOOK_PS = NO
BUILD_DOCBOOK_PDF = NO
unfortunately, when compiling i still get the ld error
*** *** ghc -fglasgow-exts --make -shared -oHs2lib.a
/tmp/Hs2lib924498/Hs2lib.hs dllmain.o -static
-fno-warn-deprecated-flags -O2 -package ghc -package Hs2lib
-funfolding-use-threshold=16 -optc-O3 -optc-ffast-math
Linking a.out ...
*** /usr/bin/ld: /tmp/Hs2lib924498/Hs2lib.o: relocation R_X86_64_32
against `ghczmprim_GHCziUnit_Z0T_closure' can not be used when making
a shared object; recompile with -fPIC
*** /tmp/Hs2lib924498/Hs2lib.o: could not read symbols: Bad value
I've also told cabal to build any packages with -fPIC and shared.