Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 304075 - dev-lang/ghc-6.10.4-r1 Segfault in ghci (unstable package)
Summary: dev-lang/ghc-6.10.4-r1 Segfault in ghci (unstable package)
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: AMD64 Linux
: High minor (vote)
Assignee: Gentoo's Haskell Language team
URL:
Whiteboard:
Keywords:
Depends on: 299492
Blocks:
  Show dependency tree
 
Reported: 2010-02-08 21:59 UTC by Niklas Johansson
Modified: 2010-07-25 07:35 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (info.txt,4.09 KB, text/plain)
2010-02-08 22:01 UTC, Niklas Johansson
Details
locale (locale.txt,306 bytes, text/plain)
2010-02-08 22:05 UTC, Niklas Johansson
Details
emerge --info for system that works (compiles correctly) (emerge.info_working,4.06 KB, text/plain)
2010-04-23 15:07 UTC, Niklas Johansson
Details
strace log file (strace.ghc.6.10.x.working,1.49 KB, text/plain)
2010-07-19 12:59 UTC, Niklas Johansson
Details
emerge --info for working (with and without MASK for ghc-6.10.x) (emerge.info_still_working,4.46 KB, text/plain)
2010-07-19 13:02 UTC, Niklas Johansson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Niklas Johansson 2010-02-08 21:59:33 UTC
Using: dev-lang/ghc-6.10.4-r1

Segfaults when running cghi

~ $ ghci
GHCi, version 6.10.4: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
Segmentation fault

dmesg:
[ 4723.424345] ghc[26382]: segfault at 0 ip 000000000138727a sp 00007fff043ab2f0 error 4 in ghc[400000+10e5000]
[ 4725.844480] ghc[26385]: segfault at 0 ip 000000000138727a sp 00007fff1ef10e20 error 4 in ghc[400000+10e5000]



Reproducible: Always
Comment 1 Niklas Johansson 2010-02-08 22:01:00 UTC
Created attachment 218935 [details]
emerge --info
Comment 2 Niklas Johansson 2010-02-08 22:05:12 UTC
Created attachment 218937 [details]
locale

I noticed that the bugs for stabile packages mention this information
Comment 3 Peter Volkov (RETIRED) gentoo-dev 2010-02-09 09:01:19 UTC
Please, try to build packages with symbols (add -ggdb into CFLAGS and split debug into FEATURES) and get backtrace as explained here:
http://www.gentoo.org/proj/en/qa/backtraces.xml

BTW, drop -fomit-frame-pointer from CFLAGS since it useless on amd64.
Comment 4 Niklas Johansson 2010-02-09 10:30:15 UTC
(In reply to comment #3)
> Please, try to build packages with symbols (add -ggdb into CFLAGS and split
> debug into FEATURES) and get backtrace as explained here:
> http://www.gentoo.org/proj/en/qa/backtraces.xml
> 
> BTW, drop -fomit-frame-pointer from CFLAGS since it useless on amd64.
> 

Okay, I removed the fomit-frame-pointer (thanks by the way) and added -ggdb to my CFLAGS and recompiled.

It seems like the /usr/bin/ghci and /usr/bin/ghc are shell scripts. Therefore I tried

    gdb /usr/lib64/ghc-6.10.4/ghc 

which gave me:

    Reading symbols from /usr/lib64/ghc-6.10.4/ghc...(no debugging symbols found)...done.

So I guess I am doing something wrong.

Do you want me to compile it in a different way (now I change the main CFLAGS in the /etc/make.conf file)?
Comment 5 Peter Volkov (RETIRED) gentoo-dev 2010-02-10 07:08:02 UTC
Please, take a look at link I gave you. It provides all required information.
Have you added splitdebug into FEATURES? If you failed to do that portage will strip symbols.
Comment 6 Niklas Johansson 2010-02-12 08:06:44 UTC
(In reply to comment #5)
> Please, take a look at link I gave you. It provides all required information.
> Have you added splitdebug into FEATURES? If you failed to do that portage will
> strip symbols.
> 



I have this in my /etc/make.conf file
CFLAGS="-march=native -O2 -ggdb"
CXXFLAGS="${CFLAGS}"
FEATURES="splitdebug" # to keep the info


This are my debug files
~ $ find /usr/lib/debug/ | grep ghc
/usr/lib/debug/usr/lib64/ghc-6.10.4
/usr/lib/debug/usr/lib64/ghc-6.10.4/unlit.debug


Here is what gdb looks like:
gdb /usr/lib64/ghc-6.10.4/ghc

warning: Can not parse XML syscalls information; XML support was disabled at compile time.
GNU gdb (Gentoo 7.0 p1) 7.0
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>...
Reading symbols from /usr/lib64/ghc-6.10.4/ghc...(no debugging symbols found)...done.
(gdb) 


-------
I did the same test of dia (another program I built later with the same settings (CFLAGS and FEATURES); this is what I got 
~ $ find /usr/lib/debug/ | grep dia
/usr/lib/debug/usr/lib64/dia
/usr/lib/debug/usr/lib64/dia/libdia.so.debug
/usr/lib/debug/usr/lib64/dia/libstandard_objects.so.debug
/usr/lib/debug/usr/lib64/dia/libnetwork_objects.so.debug
/usr/lib/debug/usr/lib64/dia/libuml_objects.so.debug
/usr/lib/debug/usr/lib64/dia/liber_objects.so.debug
/usr/lib/debug/usr/lib64/dia/libfs_objects.so.debug
/usr/lib/debug/usr/lib64/dia/libflowchart_objects.so.debug
/usr/lib/debug/usr/lib64/dia/libcustom_objects.so.debug
/usr/lib/debug/usr/lib64/dia/libcustom_lines_objects.so.debug
/usr/lib/debug/usr/lib64/dia/libgrafcet_objects.so.debug
....
/usr/lib/debug/usr/bin/dia.debug



gdb /usr/bin/dia

warning: Can not parse XML syscalls information; XML support was disabled at compile time.
GNU gdb (Gentoo 7.0 p1) 7.0
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>...
Reading symbols from /usr/bin/dia...Reading symbols from /usr/lib64/debug/usr/bin/dia.debug...done.
(no debugging symbols found)...done.
(gdb) 
Comment 7 Ivan 2010-02-12 09:53:19 UTC
(In reply to comment #6)
> I have this in my /etc/make.conf file
> CFLAGS="-march=native -O2 -ggdb"
> CXXFLAGS="${CFLAGS}"
> FEATURES="splitdebug" # to keep the info

I think the -ggdb in your CFLAGS might be the problem here; at times ghc does mangling of GCC output, and the inclusion of debugger output from GCC might be cauusing the GHC build process to do something wrong...

Of course, I might have no idea what I'm talking about, since my knowledge of GCC internals and what GHC does with them are minimal...
Comment 8 Niklas Johansson 2010-02-12 10:48:45 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > I have this in my /etc/make.conf file
> > CFLAGS="-march=native -O2 -ggdb"
> > CXXFLAGS="${CFLAGS}"
> > FEATURES="splitdebug" # to keep the info
> 
> I think the -ggdb in your CFLAGS might be the problem here; at times ghc does
> mangling of GCC output, and the inclusion of debugger output from GCC might be
> cauusing the GHC build process to do something wrong...
> 

I do not know if I understood you correctly, because I originally got the segfault with these cflags:
   CFLAGS="-march=core2 -msse4.1 -O2 -pipe -fomit-frame-pointer"

I change those to
   CFLAGS="-march=native -O2 -ggdb"
for the debugging reasons. (I get segfault here as well).



Comment 9 Peter Volkov (RETIRED) gentoo-dev 2010-02-13 09:28:59 UTC
dev-lang/ghc-6.10.4-r1 strips symbols (see bug 299492) that's why you are unable to get backtrace... That said, it looks like currently stable version 6.8.2-r1 does not have such bug. You could try to reproduce failure there.
Comment 10 Niklas Johansson 2010-02-13 10:59:42 UTC
(In reply to comment #9)
> dev-lang/ghc-6.10.4-r1 strips symbols (see bug 299492) that's why you are
> unable to get backtrace... That said, it looks like currently stable version
> 6.8.2-r1 does not have such bug. You could try to reproduce failure there.
> 

I tried the stable package first but was unable to compile, even after following the workaround found in the other bug reports:
    LC_ALL=C emerge ghc

Maybe we should close this, and I will file a new bugreport for ghc-6.8.2-r1? (where I describe my problems to compile)
Comment 11 Niklas Johansson 2010-04-23 15:06:28 UTC
I tried again after cleaning a bit in my system and it worked fine!

Emerging (1 of 2) dev-lang/ghc-6.10.4-r1
>>> Installing (1 of 2) dev-lang/g-6.10.4-r1
>>> Recording dev-lang/ghc in "world" favoritefile...


I am starting to think that my haskell problems stems from my bad "locals" (character set). 

Howerver, is there anything I can provide that would help or should we close this.

Comment 12 Niklas Johansson 2010-04-23 15:07:11 UTC
Created attachment 228889 [details]
emerge --info for system that works (compiles correctly)
Comment 13 Sergei Trofimovich (RETIRED) gentoo-dev 2010-07-16 20:43:21 UTC
We had problems with portage wrongly stripping HSffi.o module in ghc-6.12 branch, but not in ghc-6.10.x. (It might be upstream problem http://hackage.haskell.org/trac/ghc/ticket/3580)

Niklas, can you locally patch your ebuild by adding following line to ghc-6.10.4-r1 ebuild:

    STRIP_MASK="*/HSffi.o"

(you can look at ghc-6.12.3 to find exact place to plug this thing in)
and verify it cures the problem comparing to unpatched one?


Strace logs of SEGVing ghci are highly appreciated:

    $ strace -oghci-failure.log ghci -v
Comment 14 Niklas Johansson 2010-07-19 12:57:07 UTC
(In reply to comment #13)
> We had problems with portage wrongly stripping HSffi.o module in ghc-6.12
> branch, but not in ghc-6.10.x. (It might be upstream problem
> http://hackage.haskell.org/trac/ghc/ticket/3580)
> 
> Niklas, can you locally patch your ebuild by adding following line to
> ghc-6.10.4-r1 ebuild:
> 
>     STRIP_MASK="*/HSffi.o"
> 
> (you can look at ghc-6.12.3 to find exact place to plug this thing in)
> and verify it cures the problem comparing to unpatched one?
> 
> 
> Strace logs of SEGVing ghci are highly appreciated:
> 
>     $ strace -oghci-failure.log ghci -v
> 

Hey, I did the following:

Deleted ghc-6.12.x

Changed the .ebuild including the MASK as you wrote
Emerged ghc-6.10.x successfully
Staced it (I am a bit unsure if I did this correctly) 

Deleted ghc-6.10.x

Changed the .ebuild back to be without MASK
Emerged ghc-6.10.x successfully 

Deleted ghc-6.10.x

Removed my ccache option
Emerged ghc-6.10.x successfully

---
So it seems that I can no longer reproduce the error, with or without MASK.
Comment 15 Niklas Johansson 2010-07-19 12:59:06 UTC
Created attachment 239379 [details]
strace log file
Comment 16 Niklas Johansson 2010-07-19 13:02:19 UTC
Created attachment 239381 [details]
emerge --info for working (with and without MASK for ghc-6.10.x)
Comment 17 Sergei Trofimovich (RETIRED) gentoo-dev 2010-07-19 17:44:34 UTC
Heh, you were expected to attach ghci-failure.log for SEGVing case, but if you can't reproduce the failure any more we don't need the log.

Maybe portage changed stripping heuristics a little since that time or something was fixed in the toolchain.

I'm closing it as WORKSFORME.

Please reopen (or create another ticket if it's handier) if you will be able to reproduce an error. We will try to explore the crash in more detail then.

Thank you for the feedback.
Comment 18 Niklas Johansson 2010-07-25 07:35:07 UTC
Thank you for your time and effort. Sorry I couldn't reproduce it anymore.