Skip to content
This repository has been archived by the owner on Apr 25, 2020. It is now read-only.

Unhandled ELF relocation(RelA) type 42 when using ArchLinux #762

Closed
sfilipov opened this issue Mar 3, 2016 · 40 comments
Closed

Unhandled ELF relocation(RelA) type 42 when using ArchLinux #762

sfilipov opened this issue Mar 3, 2016 · 40 comments

Comments

@sfilipov
Copy link

sfilipov commented Mar 3, 2016

I have repository which compiles OK both on Arch and Ubuntu using stack LTS 5. Repository Link. On Ubuntu, I can also ghc-mod check files without a problem, but on Arch I get:

ghc-mod: /home/simeon/.stack/snapshots/x86_64-linux/lts-5.0/7.10.3/lib/x86_64-linux-ghc-7.10.3/HDBC-sqlite3-2.3.3.1-J7BRkfYWClZD8ttodrMiVd/libHSHDBC-sqlite3-2.3.3.1-J7BRkfYWClZD8ttodrMiVd.a: unhandled ELF relocation(RelA) type 42

unable to load package HDBC-sqlite3-2.3.3.1

On Ubuntu, GHC is 7.10.3 downloaded during stack setup and ghc-mod is compiled using it.
On Arch, I tried both compiling GHC and ghc-mod, and using system packages for both. I get the same results.

Here is ghc-mod debug from Arch:

Root directory:       /home/simeon/repos/HLINQ
Current directory:    /home/simeon/repos/HLINQ
GHC Package flags:
    -hide-all-packages -no-user-package-db -package-db
    /home/simeon/.stack/snapshots/x86_64-linux/lts-5.0/7.10.3/pkgdb
    -package-db
    /home/simeon/repos/HLINQ/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/pkgdb
    -package-id HDBC-2.4.0.1-9022dccb33fa7027f85b22fa779bd1cb
    -package-id HDBC-sqlite3-2.3.3.1-1b20b2adef4cb0b0aa3ee08f557903c9
    -package-id base-4.8.2.0-0d6d1084fbc041e1cded9228e80e264d
    -package-id convertible-1.1.1.0-629af81285a24a4dffdb5da84aa32fd3
    -package-id hashable-1.2.4.0-1c5b5b3e4d9b3066cec16b077238de40
    -package-id
    template-haskell-2.10.0.0-3c4cb52230f347282af9b2817f013181
GHC System libraries: /usr/lib/ghc-7.10.3
GHC user options:

Stack ghc executable:    Just "/usr/bin/ghc"
Stack ghc-pkg executable:Just "/usr/bin/ghc-pkg"
Cabal file:           Just "/home/simeon/repos/HLINQ/HLINQ.cabal"
Project:   StackProject (StackEnv {seDistDir = ".stack-work/dist/x86_64-linux/Cabal-1.22.5.0", seBinPath = ["/home/simeon/.stack/snapshots/x86_64-linux/lts-5.0/7.10.3/bin","/home/simeon/.local/bin","/usr/local/sbin","/usr/local/bin","/usr/bin","/usr/bin/site_perl","/usr/bin/vendor_perl","/usr/bin/core_perl"], seSnapshotPkgDb = "/home/simeon/.stack/snapshots/x86_64-linux/lts-5.0/7.10.3/pkgdb", seLocalPkgDb = "/home/simeon/repos/HLINQ/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/pkgdb"})
Cabal entrypoints:
    Setup.hs
        Main (/home/simeon/repos/HLINQ/Setup.hs)
    library
        Database.HLINQ (/home/simeon/repos/HLINQ/Database/HLINQ.hs)
        Database.HLINQ.Info (/home/simeon/repos/HLINQ/Database/HLINQ/Info.hs)
        Database.HLINQ.Utilities (/home/simeon/repos/HLINQ/Database/HLINQ/Utilities.hs)
        Database.HLINQ.Info.Internal (/home/simeon/repos/HLINQ/Database/HLINQ/Info/Internal.hs)
        Database.HLINQ.Deconstructor (/home/simeon/repos/HLINQ/Database/HLINQ/Deconstructor.hs)
        Database.HLINQ.Constructor (/home/simeon/repos/HLINQ/Database/HLINQ/Constructor.hs)
Cabal components:
    Setup.hs
        Main (/home/simeon/repos/HLINQ/Setup.hs)
    library
        Database.HLINQ (/home/simeon/repos/HLINQ/Database/HLINQ.hs)
            Database.HLINQ.Info
        Database.HLINQ.Info (/home/simeon/repos/HLINQ/Database/HLINQ/Info.hs)
            Database.HLINQ.Utilities
            Database.HLINQ.Info.Internal
            Database.HLINQ.Deconstructor
        Database.HLINQ.Utilities (/home/simeon/repos/HLINQ/Database/HLINQ/Utilities.hs)
        Database.HLINQ.Info.Internal (/home/simeon/repos/HLINQ/Database/HLINQ/Info/Internal.hs)
            Database.HLINQ.Utilities
            Database.HLINQ.Deconstructor
            Database.HLINQ.Constructor
        Database.HLINQ.Deconstructor (/home/simeon/repos/HLINQ/Database/HLINQ/Deconstructor.hs)
            Database.HLINQ.Constructor
        Database.HLINQ.Constructor (/home/simeon/repos/HLINQ/Database/HLINQ/Constructor.hs)
GHC Cabal options:
    Setup.hs
    library
        -fbuilding-cabal-package -O -outputdir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -odir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -hidir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -stubdir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -i
        -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -i.
        -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -optP-include
        -optP.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen/cabal_macros.h
        -hide-all-packages -no-user-package-db -package-db
        /home/simeon/.stack/snapshots/x86_64-linux/lts-5.0/7.10.3/pkgdb
        -package-db
        /home/simeon/repos/HLINQ/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/pkgdb
        -package-id HDBC-2.4.0.1-9022dccb33fa7027f85b22fa779bd1cb
        -package-id HDBC-sqlite3-2.3.3.1-1b20b2adef4cb0b0aa3ee08f557903c9
        -package-id base-4.8.2.0-0d6d1084fbc041e1cded9228e80e264d
        -package-id convertible-1.1.1.0-629af81285a24a4dffdb5da84aa32fd3
        -package-id hashable-1.2.4.0-1c5b5b3e4d9b3066cec16b077238de40
        -package-id
        template-haskell-2.10.0.0-3c4cb52230f347282af9b2817f013181
        -XHaskell2010
GHC search path options:
    Setup.hs
    library
        -i -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -i.
        -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -optP-include
        -optP.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen/cabal_macros.h

And ghc-mod debug from Ubuntu VM:

Root directory:       /vagrant
Current directory:    /vagrant
GHC Package flags:
    -hide-all-packages -no-user-package-db -package-db
    /home/vagrant/.stack/snapshots/x86_64-linux/lts-5.0/7.10.3/pkgdb
    -package-db
    /vagrant/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/pkgdb
    -package-id HDBC-2.4.0.1-6fef4f36861a75d59952102632a5fb32
    -package-id HDBC-sqlite3-2.3.3.1-1b20b2adef4cb0b0aa3ee08f557903c9
    -package-id base-4.8.2.0-0d6d1084fbc041e1cded9228e80e264d
    -package-id convertible-1.1.1.0-82b9cd7e0c1851d519f2368947fa1dcf
    -package-id hashable-1.2.4.0-53b854df9b1b40e67238bc0b030f3c19
    -package-id
    template-haskell-2.10.0.0-3c4cb52230f347282af9b2817f013181
GHC System libraries: /home/vagrant/.stack/programs/x86_64-linux/ghc-7.10.3/lib/ghc-7.10.3
GHC user options:

Stack ghc executable:    Just "/home/vagrant/.stack/programs/x86_64-linux/ghc-7.10.3/bin/ghc"
Stack ghc-pkg executable:Just "/home/vagrant/.stack/programs/x86_64-linux/ghc-7.10.3/bin/ghc-pkg"
Cabal file:           Just "/vagrant/HLINQ.cabal"
Project:   StackProject (StackEnv {seDistDir = ".stack-work/dist/x86_64-linux/Cabal-1.22.5.0", seBinPath = ["/home/vagrant/.stack/snapshots/x86_64-linux/lts-5.0/7.10.3/bin","/home/vagrant/.stack/programs/x86_64-linux/ghc-7.10.3/bin","/home/vagrant/.local/bin","/usr/local/sbin","/usr/local/bin","/usr/sbin","/usr/bin","/sbin","/bin","/usr/games","/usr/local/games"], seSnapshotPkgDb = "/home/vagrant/.stack/snapshots/x86_64-linux/lts-5.0/7.10.3/pkgdb", seLocalPkgDb = "/vagrant/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/pkgdb"})
Cabal entrypoints:
    Setup.hs
        Main (/vagrant/Setup.hs)
    library
        Database.HLINQ (/vagrant/Database/HLINQ.hs)
        Database.HLINQ.Info (/vagrant/Database/HLINQ/Info.hs)
        Database.HLINQ.Utilities (/vagrant/Database/HLINQ/Utilities.hs)
        Database.HLINQ.Info.Internal (/vagrant/Database/HLINQ/Info/Internal.hs)
        Database.HLINQ.Deconstructor (/vagrant/Database/HLINQ/Deconstructor.hs)
        Database.HLINQ.Constructor (/vagrant/Database/HLINQ/Constructor.hs)
Cabal components:
    Setup.hs
        Main (/vagrant/Setup.hs)
    library
        Database.HLINQ (/vagrant/Database/HLINQ.hs)
            Database.HLINQ.Info
        Database.HLINQ.Info (/vagrant/Database/HLINQ/Info.hs)
            Database.HLINQ.Utilities
            Database.HLINQ.Info.Internal
            Database.HLINQ.Deconstructor
        Database.HLINQ.Utilities (/vagrant/Database/HLINQ/Utilities.hs)
        Database.HLINQ.Info.Internal (/vagrant/Database/HLINQ/Info/Internal.hs)
            Database.HLINQ.Utilities
            Database.HLINQ.Deconstructor
            Database.HLINQ.Constructor
        Database.HLINQ.Deconstructor (/vagrant/Database/HLINQ/Deconstructor.hs)
            Database.HLINQ.Constructor
        Database.HLINQ.Constructor (/vagrant/Database/HLINQ/Constructor.hs)
GHC Cabal options:
    Setup.hs
    library
        -fbuilding-cabal-package -O -outputdir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -odir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -hidir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -stubdir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -i
        -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -i.
        -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -optP-include
        -optP.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen/cabal_macros.h
        -hide-all-packages -no-user-package-db -package-db
        /home/vagrant/.stack/snapshots/x86_64-linux/lts-5.0/7.10.3/pkgdb
        -package-db
        /vagrant/.stack-work/install/x86_64-linux/lts-5.0/7.10.3/pkgdb
        -package-id HDBC-2.4.0.1-6fef4f36861a75d59952102632a5fb32
        -package-id HDBC-sqlite3-2.3.3.1-1b20b2adef4cb0b0aa3ee08f557903c9
        -package-id base-4.8.2.0-0d6d1084fbc041e1cded9228e80e264d
        -package-id convertible-1.1.1.0-82b9cd7e0c1851d519f2368947fa1dcf
        -package-id hashable-1.2.4.0-53b854df9b1b40e67238bc0b030f3c19
        -package-id
        template-haskell-2.10.0.0-3c4cb52230f347282af9b2817f013181
        -XHaskell2010
GHC search path options:
    Setup.hs
    library
        -i -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -i.
        -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -optP-include
        -optP.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen/cabal_macros.h
@DanielG
Copy link
Owner

DanielG commented Mar 5, 2016

I've experienced this on Debian sid too, I don't remember if it was reloc type 42 or something else but other than that. I tracked it down to a change in GNU LD tripping up the dynamic linker in GHCi, the weird thing is that the reloc type I was looking at was added quite a few years ago so it's strange the error is only popping up now.

Maybe Stack is defaulting to dynamic linking whereas Cabal does static linking by default? I'm not actually sure what the defaults are though.

Anyways I'd try disabling dynamic linking.

@waldheinz
Copy link

I'm facing this problem as well, but with the double-conversion-2.0.1.0 package and without using stack (plain Cabal package), also on Arch. I'd like to try out disabling dynamic linking but could not dig out if that's possible for me (or how). Could you provide some pointers on how to do this, @DanielG ?

@DanielG
Copy link
Owner

DanielG commented Mar 12, 2016

Hmm, looks like I was wrong. I could've sworn there is a --disable-library-dynamic flag for cabal but there isn't.

Since I can't think of any other workaround we'll have to report this upstream instead. Can you try loading an affected package in ghci and see if that break too? If that's the case reporting this is easy, if it is something ghc-mod specific though then I'll have to give it a closer look.

$ ghci -package double-conversion-2.0.1.0 should do, my guess would be that it will only crash once you actually import something from that package and maybe even only after you use something though so try that.

@paluh
Copy link

paluh commented Mar 14, 2016

Hi,

I'm also experiencing this problem on Arch (unhandled ELF relocation(RelA) type 42 unable to load package yaml-0.8.16).
I'm not sure if this information can help, but if I create trivial file (no imports, simple main with basic type error) and call on it: stack exec ghc-mod -- check src/Check.hs I'm getting proper report from ghc-mod. It is enough to add QuasiQuoting or TemplateHaskell (I wasn't able to find any other problematic addon) language extensions to cause "unhandled ELF relocation".

@waldheinz
Copy link

My experiments with ghci -package double-conversion-2.0.1.0 worked, so it seems to be a ghc-mod problem. I'm also under the impression that it's related to TemplateHaskell, I just threw out some unused LANGUAGE pragmas (TH was among them); et voila: ghc-mod can again deal with my code. At least this solves my immediate problem. :-)

@dkasak
Copy link

dkasak commented Mar 18, 2016

I also just encountered this on Arch with the package persistent-sqlite-2.2 (so TemplateHaskell is used for deriving Persistent fields). Loading it into ghci with ghci -package persistent-sqlite-2.2 works.

It's also curious that this only started happening in the last several days. A few days earlier I was able to ghc-mod check the same files without problems. I did an upgrade of system packages yesterday, yet I couldn't find anything that looked related in the list of packages upgraded.

@DanielG
Copy link
Owner

DanielG commented Mar 19, 2016

@waldheinz If it's related to TH you can try passing -XTemplateHaskell to ghci so it has the same compiler configuration that ghc-mod would use. ghci -package double-conversion-2.0.1.0 -XTemplateHaskell.

@DanielG
Copy link
Owner

DanielG commented Mar 19, 2016

@dkasak @paluh same request to you guys.

@kosmikus
Copy link

I'm also experiencing this problem on a new Ubuntu 16.04 installation, for the double-conversion-2.0.1.0 package. GHCi loading works for me, also with -XTemplateHaskell passed.

@dkasak
Copy link

dkasak commented Mar 20, 2016

@DanielG ghci loads successfully even with -XTemplateHaskell.

@waldheinz
Copy link

@DanielG Same for me, though I'm not sure if I'm testing correctly. Here is what I do:

$ ghci -package double-conversion-2.0.1.0 -XTemplateHaskell
GHCi, version 7.10.3: http://www.haskell.org/ghc/  :? for help
Prelude> import Data.Double.Conversion.Text
Prelude Data.Double.Conversion.Text> import Data.Text
Prelude Data.Double.Conversion.Text Data.Text> toShortest 0.5
"0.5"

Is this enough to say that it works?

@glittershark
Copy link

Happening to me as well with yaml-0.8.15.3. GHCI works just fine, even with -XTemplateHaskell

@japgolly
Copy link

I'm getting this on Arch Linux too. In my case I blew away all of my ~/.{cabal,ghc,ghc-mod,stack} dirs, ran stack install ghc-mod then ran stack exec ghc-mod check src/Lib.hs and got:

ghc-mod: /home/golly/haskell/.stack/snapshots/x86_64-linux/lts-5.10/7.10.3/lib/x86_64-linux-ghc-7.10.3/cryptonite-0.10-9z0j8QI27Av2VIWw0mEkTO/libHScryptonite-0.10-9z0j8QI27Av2VIWw0mEkTO.a: unhandled ELF relocation(RelA) type 42

unable to load package `cryptonite-0.10'

Are there any known workarounds for this?

@RussHewgill
Copy link

For arch linux, you can downgrade to 2016-02-21 and rebuild the cabal sandbox to get it working again.

On an up to date Arch, I can reproduce it by creating a new project and sandbox, installing glib-0.13.2, and adding {-# LANGUAGE TemplateHaskell #-} to Main.hs.
Output:

ghc-mod: /path/to/project/.cabal-sandbox/lib/x86_64-linux-ghc-7.10.3/glib-0.13.2.2-1k0TiRm3S3u0RjZ08MH1od/libHSglib-0.13.2.2-1k0TiRm3S3u0RjZ08MH1od.a: unhandled ELF relocation(RelA) type 42

unable to load package `glib-0.13.2.2'

Removing the TemplateHaskell pragma or not installing glib makes it work correctly.

One of the packages that was upgraded on 2016-02-21 was glibc, from 2.22-4 to 2.23-1, so that package may be the source of the problem.

@smayr42
Copy link

smayr42 commented Apr 23, 2016

The source of this problem seems to be that gas >= 2.26 uses some new relocation types (in particular type 42, aka R_X86_64_REX_GOTPCRELX), which are not supported by ghc's linker. As a workaround, these relocation types can be disabled by invoking ghc with the flag -opta-Wa,-mrelax-relocations=no. If you're using cabal you can pass the flag to ghc as follows:

cabal install --ghc-options="-opta-Wa,-mrelax-relocations=no"

It's probably necessary to reinstall all packages with this flag.

Could ghc-mod use the system dynamic linker (just like ghci) to fix this properly?

@DanielG
Copy link
Owner

DanielG commented Apr 24, 2016

@Sam142 Ah, that makes sense. I was just looking at the wrong component. I'm not aware of ghci being able to use the system linker is that something new or what exactly are you referring to?

@DanielG
Copy link
Owner

DanielG commented Apr 24, 2016

Never mind found the docs for that https://ghc.haskell.org/trac/ghc/wiki/DynamicGhcPrograms.

rpglover64 added a commit to rpglover64/IHaskell that referenced this issue May 10, 2016
Suggestion from: DanielG/ghc-mod#762
Addresses: IHaskell#636

I do not fully understand the implications of this change, but it fixed the problem for me (once I forced stack to rebuild `cryptonite`)
@sjackman
Copy link

sjackman commented May 11, 2016

I'm seeing this error as well:

$ runghc hello.hs
ghc: /home/sjackman/.linuxbrew/Cellar/ghc/7.10.3b/libexec/integer-gmp/lib/libgmp.a: unhandled ELF relocation(RelA) type 42

ghc: unable to load package `integer-gmp-1.0.0.0'

I'm also using gas 2.26.20160125. I don't see the error with ghc instead of runghc:

$ ghc hello.hs -o hello
$ ./hello
Hello, world!

Is there a fix, other than using an older version of binutils? Is there an upstream ghc ticket tracking this issue?

@jmaicher
Copy link

jmaicher commented Jun 1, 2016

I'm facing the same problem with cipher-aes-0.2.11 after bootstrapping a minimal yesod project on ubuntu 16.04:

$ stack exec ghc-mod check Application.hs
ghc-mod: /home/docker/.stack/snapshots/x86_64-linux/lts-6.1/7.10.3/lib/x86_64-linux-ghc-7.10.3/cipher-aes-0.2.11-LCbQiUgBdfG1swKGFESvIB/libHScipher-aes-0.2.11-LCbQiUgBdfG1swKGFESvIB.a: unhandled ELF relocation(RelA) type 42

unable to load package `cipher-aes-0.2.11'

Using the ghc options -opta-Wa,-mrelax-relocations=no for cipher-aes didn't work.
I created a minimal docker file [1] to reproduce the error.

[1] https://gist.github.com/jmaicher/6d8b0e692285e4fe4f68cade25cbf127

@gbaz
Copy link

gbaz commented Jun 2, 2016

filed a ghc ticket here https://ghc.haskell.org/trac/ghc/ticket/12147

@denibertovic
Copy link

Is there a workaround for this? (it's unclear to me) I tried running:

stack build --ghc-options="-opta-Wa,-mrelax-relocations=no"

But it didn't help.

@erikd
Copy link

erikd commented Jun 4, 2016

Is there a way to reproduce this without stack?

@Mistuke
Copy link

Mistuke commented Jun 5, 2016

Patched in GHC with commit ghc/ghc@0d963ca

Thanks for the report!

@erikd
Copy link

erikd commented Jun 5, 2016

What @Mistuke means is that is fixed in GHC git and will certainly be in GHC 8.0.2. The GHC developers may also consider rolling a GHC 7.10.4 release with this fix.

@thomasjm
Copy link

Hmm, does anyone know if it's possible to use stack to install GHC git? (Alternatively, is there a way to tell when this patch makes it into a Stackage nightly build?) This problem is a bit of a blocker for me...

@erikd
Copy link

erikd commented Jun 11, 2016

@thomasjm I would suggest jumping on the ticket https://ghc.haskell.org/trac/ghc/ticket/12147 and (politely of course) requesting a 8.0.2 GHC release including this fix. If you also need ghc-7.10 fixed, I suggest asking for that as well.

@thomie
Copy link

thomie commented Jun 13, 2016

Can somebody please provide reproduction instructions for this bug.

A possible workaround is to build ghc-mod with --enable-executable-dynamic.

@erikd
Copy link

erikd commented Jun 14, 2016

I spent an hour last night trying to reproduce this but wasn't able to.

@sjackman
Copy link

sjackman commented Jun 14, 2016

Previously to reproduce this error, I ran:

docker pull linuxbrew/linuxbrew
docker run -it linuxbrew/linuxbrew
brew install binutils gcc
brew install -s ghc
brew test ghc # or runghc hello.hs

I haven't tested recently.
See https://github.com/Linuxbrew/homebrew-core/pull/241#issuecomment-218608170

@erikd
Copy link

erikd commented Jun 14, 2016

@sjackman Sorry, but that is not very helpful. The reproduction instructions need to be as simple as possible. That means no docker, no brew.

@erikd
Copy link

erikd commented Jun 14, 2016

To be specific, the instructions need to be something simple enough to be use as a configure time test in GHC's configure.ac.

@sjackman
Copy link

To reproduce the issue install binutils 2.26, install GCC 5.3, install GHC 7.10.3b from source, then run runghc hello.hs, where hello.hs contains main = putStrLn "Hello".

@erikd
Copy link

erikd commented Jun 15, 2016

I'm on Debian Testing, with:

$ dpkg -l | grep binutils
ii  binutils   2.26-10    amd64        GNU assembler, linker and binary utilities

$ gcc --version
gcc (Debian 5.3.1-21) 5.3.1 20160528

and the GHC 7.10.3b sources and I still can't reproduce it.

@sjackman
Copy link

Shucks. Thanks for trying anyway. I don't have time to look into this any further now. My workaround was to use Ubuntu 14 to compile GHC with binutils 2.24 and GCC to 4.8, and transfer the executables to my system.

AaronFriel added a commit to AaronFriel/stack that referenced this issue Jun 25, 2016
Commit c891a24 created a regression, ghc-options were no longer applied to
packages in the snapshot. The "mini build plan" for missing snapshot packages
did not check the configuration's "ghc-options" settings at all, so even
configurations with "apply-ghc-options: everything" would not apply those
options.

This commit, combined with a change to config.yaml, fixes these issues:

DanielG/ghc-mod#762
IHaskell/IHaskell#636

To fix those issues,  (usually located in ) should
contain:

And for snapshots already installed, the following command will force stack
to rebuild them with those options:

*Not tested:* Alternatively, add the line  to
. This may cause undesirable behavior in forcing all ghc-options
changes to rebuild the snapshot.
@AaronFriel
Copy link

Everyone: I have found and fixed this issue, if you build Stack from my fork here: https://github.com/aaronfriel/stack you will be able to add config.yaml and stack.yaml options like so:

apply-ghc-options: everything
ghc-options:
  "*": -opta-Wa,-mrelax-relocations=no

And then you can force any packages that are causing trouble to rebuild with:

stack exec -- ghc-pkg unregister $PACKAGENAME --force

Substituting $PACKAGENAME for the package causing a problem, of course :)

To build and install my fork, just:

git clone https://github.com/AaronFriel/stack.git
cd ./stack
stack install

@sjackman
Copy link

sjackman commented Jul 1, 2016

Hi, Aaron. Can you clarify, is the option -opta-Wa,-mrelax-relocations=no used when building ghc?

@AaronFriel
Copy link

@sjackman: No, I was able to use a stock ghc. To get ghc-mod to work, I only needed to rebuild libraries that threw errors with those options.

@sigrlami
Copy link

What's status of this? Still happening occasionally on Fedora

@dkasak
Copy link

dkasak commented Sep 30, 2016

@sigrlami: Fix is in still-unreleased ghc 8.0.2 branch. Until it's released, you can use the above ghc-options trick to override for affected packages. I think the new stack release incorporated AaronFriel's changes (or equivalent) so it works out of the box now.

@DanielG
Copy link
Owner

DanielG commented Nov 7, 2017

I think this should be fixed upstream, so closing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests