How to debug a segfault.

David Brown haskell2 at
Wed Feb 28 12:32:07 EST 2007

David Brown wrote:

> Hmm.  I recompiled 'zlib' with some extra tracing and now the problem
> doesn't happen.  Even without the tracing it is fine.  Must have been
> something wrong with the compiled library.  Scary.  But, everything is
> working fine now.

I figured out what the problem is.  I've been working in a shared
directory with both an amd64 and an x86 machines using the files.
I've been going back and forth.

I've been blowing away the 'dist' directory and rebuilding when moving
from one platform to the other.

However, what I missed is that the hsc2hs target files are placed
alongside the source, not in the dist directory.  I had been building
zlib on x86 using the hs generated on an amd64 machine.  The offsets
in the structures were wrong.

How difficult would it be to have Cabal store the target files in the
'dist' directory with everything else?  This also makes revision
control a little more challenging, because I have to hand-pick a few
select .hs files to ignore, since the rest of my code is sitting right
next to them.

David Brown

More information about the Glasgow-haskell-users mailing list