[xmonad] Segfault on startup

Don Stewart dons at galois.com
Thu Mar 6 23:02:43 EST 2008


almeidaraf:
> On Thu, 6 Mar 2008 06:52:00 -0500, "Brent Yorgey" <byorgey at gmail.com> wrote:
> >
> >
> > On Thu, Mar 6, 2008 at 1:41 AM, Don Stewart <dons at galois.com> wrote:
> >      roma:
> >      > * Rafael Almeida <almeidaraf at gmail.com> [2008-03-06 02:57:16-0300]
> >      > > On Thu, Mar 6, 2008 at 2:36 AM, Don Stewart <dons at galois.com>
> >      wrote:
> >      > > > almeidaraf:
> >      > > >
> >      > > > > Hello,
> >      > > >  >
> >      > > >  > I've been using xmonad from darcs. Today I pulled the latest
> >      version
> >      > > >  > and, after compiling xmonad, I found it segfaults during the
> >      startup.
> >      > > >  > I'm running a debian 4.0 (etch) and I've installed X11 1.4.1
> >      on my
> >      > > >  > local user.
> >      > > >
> >      > > >  Almost certainly this is because you have a partially
> >      recompiled xmonad.
> >      > > >  Please do a full make clean, then try again.
> >      > > >
> >      > > >     runhaskell Setup.lhs clean
> >      > > >
> >      > > >  then rebuild.
> >      > > >
> >      > > >     http://haskell.org/haskellwiki/Xmonad/
> >      Frequently_asked_questions#Help.21_xmonad_just_segfaulted
> >      > > >
> >      > > >  Same for any config repo you use.
> >      > > >
> >      > >
> >      > > That doesn't seem the issue because I would always delete xmonad-
> >      new
> >      > > directory and recreate it using
> >      > >
> >      > > $ darcs get xmonad --to-patch=patchname xmonad-new
> >      > >
> >      > > in order to find out which patch broke it. Just in case I just
> >      did:
> >      > >
> >      > > $ darcs get http://code.haskell.org/xmonad --to-patch="Core.hs:
> >      add an
> >      > > Applicative" xmonad-new
> >      > >
> >      > > and compiled it. Sure enough, xmonad segfaulted on startup.
> >      >
> >      > As far as I see from your config, you also use xmonad contrib
> >      library.
> >      > Have you recompiled it as well?
> >
> >      Ah yes, that needs to be fully cleaned and recompiled.
> >
> >      And then confirm that without any config file it either is ok, or
> >      crashes.
> >
> > Just to make sure everything is completely clear: every time you rebuild
> > xmonad, you must do a full clean and rebuild of xmonad-contrib.  Otherwise it
> > doesn't realize that a library it depends on has changed, and continues
> > referencing the old library, which may or may not cause a crash. =(
> >
> > I'm pretty sure there's no way that simply adding an instance could cause a
> > crash, except for the recompilation problem explained above, or a bug in ghc.
> >
> > -Brent
> >
> 
> Oh yes. That was indeed the problem here. My bad :(. I was kinda thrown
> away because I thought you'd never get a Segmentation Fault from a code
> written in Haskell. But I supose that the error came from the C code on
> X11, right? Shouldn't it return a nicer error instead of segfaulting? Or
> is this behaviour expectable?

It actually came from GHC linking code that was compiled against a
different API. Due to cross module optimisations, its possible to
partially recompile some code, then modify some source, continue
compiling and link against an incorrect api.

Usually this results in undefined symbols, but occasionally you see
somehting like this.

If the source changes, via a darcs patch, always best to clean and
recompile. :)

-- Don


More information about the xmonad mailing list