Thanks for looking into this Mathieu. I have been using this hsc2hs flag all along, and it has enabled me to build inline-r, but the build of H fails (using ghc-8.0.1). As you mention in your issue tracker, the new twist is to add ghc-options: -dynamic to the cabal file for H (and for any binary that links to inline-r).
BTW, how can I compare my results with yours if all I know is that you have used "a docker container"? Wouldn't I need to know what repository and snapshot you are using? On Sun, Aug 14, 2016 at 2:55 PM, Boespflug, Mathieu <[email protected]> wrote: > I was able to reproduce in a docker container and tracked down the source of > the issue: https://github.com/tweag/HaskellR/issues/257 > > 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. > > A workaround is to set "cc-options: -fPIC" in the .cabal file. But in my > mind this is probably a Cabal bug. > > -- > Mathieu Boespflug > Founder at http://tweag.io. > > On 14 August 2016 at 06:12, Dominick Samperi <[email protected]> wrote: >> >> I should add that H builds and runs nicely under Windows and MacOS >> (using ghc 8.0.1), so this is indeed a Fedora Linux issue. >> >> On Sat, Aug 13, 2016 at 10:22 AM, Dominick Samperi <[email protected]> >> wrote: >> > Hello Mathieu, >> > >> > I'm using Fedora 23. The default Haskell Platform here provides ghc >> > 7.8.4, and this seems to have even more problems. Thus I have been >> > trying to use ghc 8.0.1 compiled from source. I think the red herring >> > bit may apply to 32 bit builds, but I am attempting a 64 bit build. >> > The problem may be related to the way modules are randomly relocated >> > for security reasons, Fedora security policies, and confusion/bugs in >> > the linker(s). >> > >> > Cheers, >> > Dominick >> > >> > >> > On Sat, Aug 13, 2016 at 7:43 AM, Boespflug, Mathieu <[email protected]> wrote: >> >> 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 <[email protected]> >> >> 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 >> >>> [email protected] >> >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs >> >> >> >> > > _______________________________________________ ghc-devs mailing list [email protected] http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
