FS#23247 - [ghc 7.0.2] ghci -package ghc causes panic

Attached to Project: Arch Linux
Opened by patrick (brisbin33) - Friday, 11 March 2011, 21:34 GMT
Last edited by Thomas Dziedzic (tomd123) - Saturday, 03 March 2012, 17:04 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Vesa Kaihlavirta (vegai)
Rémy Oudompheng (remyoudompheng)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 5
Private No

Details

Description:

our ghc 7 build seems to be stripped of some symbols or other (maybe debug?) info required for some haskell packages. XMonad and its deps build fine, but I get a compiler panic trying to f.e. `cabal install yesod`.

I've reported upstream (http://hackage.haskell.org/trac/ghc/ticket/5004), and other distros have confirmed the bug. I'm reporting here in case there's something we can do when packaging to get around the issue.

Thanks,
pbrisbin


Additional info:
ghc 7.0.2

Steps to reproduce:

$ pacman -S ghc
$ ghci -package ghc
GHCi, version 7.0.2: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.3.0.2 ... linking ... done.
Loading package containers-0.4.0.0 ... linking ... done.
Loading package filepath-1.2.0.0 ... linking ... done.
Loading package old-locale-1.0.0.2 ... linking ... done.
Loading package old-time-1.0.0.6 ... linking ... done.
Loading package unix-2.4.2.0 ... linking ... done.
Loading package directory-1.1.0.0 ... linking ... done.
Loading package pretty-1.0.1.2 ... linking ... done.
Loading package process-1.0.1.5 ... linking ... done.
Loading package Cabal-1.10.1.0 ... linking ... done.
Loading package bytestring-0.9.1.10 ... linking ... done.
Loading package ghc-binary-0.5.0.2 ... linking ... done.
Loading package bin-package-db-0.0.0.0 ... linking ... done.
Loading package hpc-0.5.0.6 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package ghc-7.0.2 ... ghc: This ELF file contains no symtab
ghc: panic! (the 'impossible' happened)
(GHC version 7.0.2 for x86_64-unknown-linux):
loadArchive "/usr/lib/ghc-7.0.2/ghc-7.0.2/libHSghc-7.0.2.a": failed

Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
This task depends upon

Closed by  Thomas Dziedzic (tomd123)
Saturday, 03 March 2012, 17:04 GMT
Reason for closing:  Works for me
Additional comments about closing:  ghc 7.4.1 is now in extra
Comment by Vesa Kaihlavirta (vegai) - Saturday, 12 March 2011, 07:21 GMT
A workaround is to build yesod with cabal install yesod -fproduction

This disables wai-handler-devel (which the author thinks was a bad idea anyway) and makes yesod build work.
Comment by patrick (brisbin33) - Saturday, 12 March 2011, 14:37 GMT
Thanks Vesa, an Archer on the ghc bugtracker also confirmed that providing an unstripped libHSghc-7.0.2.a will allow the linking. I think I'd prefer that workaround. Now to determine how he did it...
Comment by Vesa Kaihlavirta (vegai) - Sunday, 13 March 2011, 11:11 GMT
I'll give a shot at options=(!strip). Will report back in a few hours :P
Comment by Vesa Kaihlavirta (vegai) - Monday, 14 March 2011, 08:25 GMT
Yep, that fixes it. Unsurprisingly, it grows the package a bit:

-rw-r--r-- 1 nobody nobody 52M Mar 3 23:34 ghc-7.0.2-1-i686.pkg.tar.xz
-rw-r--r-- 1 nobody nobody 54M Mar 3 23:44 ghc-7.0.2-1-x86_64.pkg.tar.xz
-rw-r--r-- 1 nobody nobody 60M Mar 14 00:57 ghc-7.0.2-2-i686.pkg.tar.xz
-rw-r--r-- 1 nobody nobody 62M Mar 14 01:09 ghc-7.0.2-2-x86_64.pkg.tar.xz

But perhaps this is worth it.
Comment by Jeff (jochus) - Tuesday, 15 March 2011, 17:04 GMT
Thanks for checking, Vesa. I'm just curious, do you know if the yesod devel server actually works after that?

I tried to do something similar and found that 'ghci -package ghc' worked but yesod still didn't. It seemed that the "no symtab" linking error was gone, but other sorts of linking problems emerged. I don't have the exact error easily available (different system), but it was something about multiple definitions within libHSghc-7.0.2.a. Then again, I wouldn't be surprised at all if I just compiled things wrong.
Comment by Vesa Kaihlavirta (vegai) - Tuesday, 15 March 2011, 18:40 GMT
Building it worked, I didn't try more.
Comment by Henrik Johansson (dahankzter) - Thursday, 17 March 2011, 20:53 GMT
It affects other packages for example Snap.
Can I help with something?
Comment by Vesa Kaihlavirta (vegai) - Friday, 18 March 2011, 08:09 GMT
I have parts of the whole shebang ready, I'll move them to testing now and continue with the rest meanwhile.

If you people could test snap & yesod against ghc-7.0.2-2, that'd be great.
Comment by Vesa Kaihlavirta (vegai) - Friday, 18 March 2011, 08:50 GMT
The whole haskell-platform is there now in [testing]
Comment by Petr Pilar (Palmik) - Friday, 18 March 2011, 15:33 GMT
I can confirm, that snap indeed builds and works with ghc-7.0.2-2 (unlike with ghc-7.0.2-1). Thanks :)
Comment by Henrik Johansson (dahankzter) - Monday, 21 March 2011, 19:13 GMT
Yes, snap works fine. Thanks!
Comment by Jeff (jochus) - Tuesday, 22 March 2011, 04:52 GMT
I just gave this a shot and I can confirm that yesod builds fine and ghci -package ghc works. But running the yesod devel-server yields a runtime linker error:

GHCi runtime linker: fatal error: I found a duplicate definition for symbol
ghczm7zi0zi2_AsmCodeGen_zdfMonadCmmOptM2_closure
whilst processing object file
/usr/lib/ghc-7.0.2/ghc-7.0.2/libHSghc-7.0.2.a
This could be caused by:
* Loading two different object files which export the same symbol
* Specifying the same object file twice on the GHCi command line
* An incorrect `package.conf' entry, causing some object to be
loaded twice.
GHCi cannot safely continue in this situation. Exiting now. Sorry.
Comment by Vesa Kaihlavirta (vegai) - Tuesday, 22 March 2011, 14:04 GMT
Thanks for the bad news, Jeff :) I guess we'll have to dig into this some more...
Comment by Rémy Oudompheng (remyoudompheng) - Wednesday, 23 March 2011, 07:06 GMT
Jeff, you need to provide us with the exact command line you used.
Comment by Jeff (jochus) - Wednesday, 23 March 2011, 07:28 GMT
Vesa, sorry for the bad news :(

Rémy, I haven't gotten around to seeing if I can make a smaller test case. But the long way around is to:

$ cabal install yesod persistent-sqlite
$ yesod
Your name: test
Project name: test
Directory name: test
Foundation: Test
So, what'll it be? s for sqlite, p for postgresql: s
$ cd test
$ runhaskell devel-server.hs

This gave me the error mentioned above. Please let me know if you need any more info.
Comment by Vesa Kaihlavirta (vegai) - Wednesday, 23 March 2011, 07:34 GMT
Compiling devel-server.hs as a binary and running that seems to work though. Is that an acceptable workaround?
Comment by Jeff (jochus) - Wednesday, 23 March 2011, 14:56 GMT
Vesa, that's brilliant - I didn't think to try that. It appears to work and is good enough of a workaround for me. By the way - thanks for all the work you guys are doing on this.
Comment by Vesa Kaihlavirta (vegai) - Wednesday, 23 March 2011, 15:47 GMT
Ok, I guess we can resume work on releasing 7.0.2-2 then.
Comment by Leif Warner (pdxleif) - Saturday, 23 April 2011, 05:06 GMT
Any updates on when this is going to hit extra? It's blocking the build of the yesod, and the -fproduction workaround doesn't seem to work for the new version.
Comment by Magnus Morton (jaffachief) - Thursday, 02 June 2011, 23:32 GMT
http://hackage.haskell.org/trac/ghc/ticket/5004 has further details. Looks like a patch has been added
Comment by Vesa Kaihlavirta (vegai) - Thursday, 23 June 2011, 15:42 GMT
ghc 7.0.4 will include that patch, so when we get that platform, this will be fixed for good
Comment by Thomas Dziedzic (tomd123) - Wednesday, 01 February 2012, 06:23 GMT
Looks like there is no more error with 7.0.3.

$ ghci -package ghc
GHCi, version 7.0.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.

....

Loading package ghc-7.0.3 ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
Prelude>
Leaving GHCi.

Loading...