<div dir="ltr">I was able to reproduce in a docker container and tracked down the source of the issue: <a href="https://github.com/tweag/HaskellR/issues/257">https://github.com/tweag/HaskellR/issues/257</a><div><br></div><div>The executive summary is that if Cabal is asking hsc2hs to link to a dynamic library, then it should pass --cflag=-fPIC to hsc2hs. Otherwise hsc2hs might fail, because then it might be impossible to link the temporary object files that it creates with the shared library.</div><div><br></div><div>A workaround is to set "cc-options: -fPIC" in the .cabal file. But in my mind this is probably a Cabal bug.</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature">--<br>Mathieu Boespflug<br>Founder at <a href="http://tweag.io" target="_blank">http://tweag.io</a>.</div></div>
<br><div class="gmail_quote">On 14 August 2016 at 06:12, Dominick Samperi <span dir="ltr"><<a href="mailto:djsamperi@gmail.com" target="_blank">djsamperi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I should add that H builds and runs nicely under Windows and MacOS<br>
(using ghc 8.0.1), so this is indeed a Fedora Linux issue.<br>
<div class="HOEnZb"><div class="h5"><br>
On Sat, Aug 13, 2016 at 10:22 AM, Dominick Samperi <<a href="mailto:djsamperi@gmail.com">djsamperi@gmail.com</a>> wrote:<br>
> Hello Mathieu,<br>
><br>
> I'm using Fedora 23. The default Haskell Platform here provides ghc<br>
> 7.8.4, and this seems to have even more problems. Thus I have been<br>
> trying to use ghc 8.0.1 compiled from source. I think the red herring<br>
> bit may apply to 32 bit builds, but I am attempting a 64 bit build.<br>
> The problem may be related to the way modules are randomly relocated<br>
> for security reasons, Fedora security policies, and confusion/bugs in<br>
> the linker(s).<br>
><br>
> Cheers,<br>
> Dominick<br>
><br>
><br>
> On Sat, Aug 13, 2016 at 7:43 AM, Boespflug, Mathieu <<a href="mailto:m@tweag.io">m@tweag.io</a>> wrote:<br>
>> Hi Dominick,<br>
>><br>
>> which version of Fedora Linux are you on? The -fPIC message from the linker<br>
>> may well be a red herring. AFAIR generating PIC is the default in GHC, at<br>
>> least for dynamic libraries.<br>
>><br>
>> Best,<br>
>><br>
>> --<br>
>> Mathieu Boespflug<br>
>> Founder at <a href="http://tweag.io" rel="noreferrer" target="_blank">http://tweag.io</a>.<br>
>><br>
>> On 13 August 2016 at 05:55, Dominick Samperi <<a href="mailto:djsamperi@gmail.com">djsamperi@gmail.com</a>> wrote:<br>
>>><br>
>>> Hello,<br>
>>><br>
>>> I am getting relocation errors when building an executable<br>
>>> (specifically, the "H"<br>
>>> executable -- part of haskellR) under Fedora Linux, and the message says<br>
>>> to<br>
>>> "recompile with -fPIC".<br>
>>><br>
>>> The FAQ associated with H suggests that I switch to the gold linker<br>
>>> (ld.gold) due to bugs in the default linker (ld.bfd), but this only<br>
>>> changes the wording of the relocation error messages.<br>
>>><br>
>>> I have tried several strategies for satisfying the -fPIC requirement:<br>
>>> 1. In cabal files I insert cc-options: and ghc-options: lines including<br>
>>> -fPIC<br>
>>> 2. To the 'cabal install' command line I add:<br>
>>>     --ghc-option=-fPIC --hsc2hs-option=-cflag=-fPIC<br>
>>> 3. When building ghc 8.0.1 from source I modify <a href="http://config.mk" rel="noreferrer" target="_blank">config.mk</a> by including:<br>
>>>    CONF_CC_OPTS += -fPIC<br>
>>>    SRC_HSC2HS_OPTS += --cflag=-fPIC<br>
>>>    CONF_CC_OPTS_STAGE0 = -fno-stack-protector -fPIC<br>
>>>    [same for STAGE1 and STAGE2]<br>
>>><br>
>>> All of this doesn't fix the problem, and the error messages still say<br>
>>> "recompile with -fPIC".<br>
>>><br>
>>> This may be a bug, but I'm not sure where. Any ideas?<br>
>>><br>
>>> Thanks,<br>
>>> Dominick<br>
>>> ______________________________<wbr>_________________<br>
>>> ghc-devs mailing list<br>
>>> <a href="mailto:ghc-devs@haskell.org">ghc-devs@haskell.org</a><br>
>>> <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/ghc-devs</a><br>
>><br>
>><br>
</div></div></blockquote></div><br></div>