How to force -fPIC on package builds?

Boespflug, Mathieu m at tweag.io
Sat Aug 13 11:43:44 UTC 2016


Hi Dominick,

which version of Fedora Linux are you on? The -fPIC message from the linker
may well be a red herring. AFAIR generating PIC is the default in GHC, at
least for dynamic libraries.

Best,

--
Mathieu Boespflug
Founder at http://tweag.io.

On 13 August 2016 at 05:55, Dominick Samperi <djsamperi at gmail.com> wrote:

> Hello,
>
> I am getting relocation errors when building an executable
> (specifically, the "H"
> executable -- part of haskellR) under Fedora Linux, and the message says to
> "recompile with -fPIC".
>
> The FAQ associated with H suggests that I switch to the gold linker
> (ld.gold) due to bugs in the default linker (ld.bfd), but this only
> changes the wording of the relocation error messages.
>
> I have tried several strategies for satisfying the -fPIC requirement:
> 1. In cabal files I insert cc-options: and ghc-options: lines including
> -fPIC
> 2. To the 'cabal install' command line I add:
>     --ghc-option=-fPIC --hsc2hs-option=-cflag=-fPIC
> 3. When building ghc 8.0.1 from source I modify config.mk by including:
>    CONF_CC_OPTS += -fPIC
>    SRC_HSC2HS_OPTS += --cflag=-fPIC
>    CONF_CC_OPTS_STAGE0 = -fno-stack-protector -fPIC
>    [same for STAGE1 and STAGE2]
>
> All of this doesn't fix the problem, and the error messages still say
> "recompile with -fPIC".
>
> This may be a bug, but I'm not sure where. Any ideas?
>
> Thanks,
> Dominick
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20160813/fc73a61b/attachment-0001.html>


More information about the ghc-devs mailing list