Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#7227 closed bug (fixed)

cannot build ghc-7.6.1 because haddock seg-faults

Reported by: maeder Owned by: simonmar
Priority: highest Milestone: 7.6.2
Component: Runtime System Version: 7.6.1
Keywords: Cc: pho@…
Operating System: Solaris Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: rts/T7227
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


"/local/home/maeder/haskell/ghc-7.6.1/inplace/bin/haddock" --odir="libraries/ghc-prim/dist-install/doc/html/ghc-prim" --no-tmp-comp-dir --dump-interface=libraries/ghc-prim/dist-install/doc/html/ghc-prim/ghc-prim.haddock --html --hoogle --title="ghc-prim- GHC primitives" --prologue="libraries/ghc-prim/dist-install/haddock-prologue.txt"   --optghc=-H32m --optghc=-O --optghc=-package-name --optghc=ghc-prim- --optghc=-hide-all-packages --optghc=-i --optghc=-ilibraries/ghc-prim/. --optghc=-ilibraries/ghc-prim/dist-install/build --optghc=-ilibraries/ghc-prim/dist-install/build/autogen --optghc=-Ilibraries/ghc-prim/dist-install/build --optghc=-Ilibraries/ghc-prim/dist-install/build/autogen --optghc=-Ilibraries/ghc-prim/. --optghc=-optP-include --optghc=-optPlibraries/ghc-prim/dist-install/build/autogen/cabal_macros.h --optghc=-package --optghc=rts-1.0 --optghc=-split-objs --optghc=-package-name --optghc=ghc-prim --optghc=-XHaskell98 --optghc=-XCPP --optghc=-XMagicHash --optghc=-XForeignFunctionInterface --optghc=-XUnliftedFFITypes --optghc=-XUnboxedTuples --optghc=-XEmptyDataDecls --optghc=-XNoImplicitPrelude --optghc=-O2 --optghc=-no-user-package-db --optghc=-rtsopts --optghc=-odir --optghc=libraries/ghc-prim/dist-install/build --optghc=-hidir --optghc=libraries/ghc-prim/dist-install/build --optghc=-stubdir --optghc=libraries/ghc-prim/dist-install/build --optghc=-hisuf --optghc=hi --optghc=-osuf --optghc=o --optghc=-hcsuf --optghc=hc    libraries/ghc-prim/./GHC/Classes.hs  libraries/ghc-prim/./GHC/CString.hs  libraries/ghc-prim/./GHC/Debug.hs  libraries/ghc-prim/./GHC/Magic.hs  libraries/ghc-prim/dist-install/build/GHC/PrimopWrappers.hs  libraries/ghc-prim/./GHC/IntWord64.hs  libraries/ghc-prim/./GHC/Tuple.hs  libraries/ghc-prim/./GHC/Types.hs libraries/ghc-prim/dist-install/build/autogen/GHC/Prim.hs +RTS -tlibraries/ghc-prim/dist-install/doc/html/ghc-prim/ghc-prim.haddock.t --machine-readable
Segmentierungsfehler - Speicherabbild 'core' geschrieben
gmake[1]: *** [libraries/ghc-prim/dist-install/doc/html/ghc-prim/ghc-prim.haddock] Fehler 139
gmake: *** [all] Fehler 2

Can I try it somehow without haddock?

Attachments (1)

log.tgz (131.9 KB) - added by maeder 5 years ago.
configure info and log of calling "make"

Download all attachments as: .zip

Change History (18)

comment:1 Changed 5 years ago by simonmar

difficulty: Unknown

You can put


in your mk/ file. (for other things to put in mk/, see mk/

comment:2 Changed 5 years ago by maeder

Right, this created a working ghc without haddock.

comment:3 Changed 5 years ago by simonmar

The next step would be to find a smaller test that is failing, and try to debug the cause.

comment:4 Changed 5 years ago by maeder

I tried to "cabal install haddock" resulting in

[31 of 31] Compiling Documentation.Haddock ( src/Documentation/Haddock.hs, dist/build/Documentation/Haddock.o )

    Couldn't match type `GhcMonad.Ghc' with `IO'
    Expected type: IO
                     ([(DocPaths, InterfaceFile)], [Interface], LinkEnv)
      Actual type: GhcMonad.Ghc
                     ([(DocPaths, InterfaceFile)], [Interface], LinkEnv)
    In the return type of a call of `readPackagesAndProcessModules'
    In a stmt of a 'do' block:
      (_, ifaces, _) <- readPackagesAndProcessModules flags modules
    In the expression:
      do { (_, ifaces, _) <- readPackagesAndProcessModules flags modules;
           return ifaces }
cabal: Error: some packages failed to install:
haddock-2.12.0 failed during the building phase. The exception was:
ExitFailure 1

comment:5 Changed 5 years ago by maeder

inplace/bin/haddock works if called without the remaining +RTS flags "+RTS -tlibraries/ghc-prim/dist-install/doc/html/ghc-prim/ghc-prim.haddock.t --machine-readable" (this was not there in ghc-

In fact, all my programs seg-fault if called with "+RTS -t..."

-bash-3.00$ cat W.hs
main = putStrLn "hello"
-bash-3.00$ ghc W.hs -rtsopts
[1 of 1] Compiling Main             ( W.hs, W.o )
Linking W ...
-bash-3.00$ gdb --args ./W +RTS -ttest
GNU gdb (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
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 "i386-pc-solaris2.10".
For bug reporting instructions, please see:
Reading symbols from /local/home/maeder/haskell/W...done.
(gdb) run
Starting program: /local/home/maeder/haskell/W +RTS -ttest
[Thread debugging using libthread_db enabled]
[New Thread 1 (LWP 1)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1 (LWP 1)]
0xfecd63ec in strlen () from /lib/

Changed 5 years ago by maeder

Attachment: log.tgz added

configure info and log of calling "make"

comment:6 Changed 5 years ago by igloo

Could you try with

ghc W.hs -rtsopts -debug

instead please? Then gdb should give you a useful backtrace.

comment:7 Changed 5 years ago by maeder

(gdb) bt
#0  0xfecd63ec in strlen () from /lib/
#1  0xfed317a2 in _ndoprnt () from /lib/
#2  0xfed34759 in vfprintf () from /lib/
#3  0x080ee097 in stats_fprintf (f=0x814e970, s=0x81296e1 "%s ") at rts/RtsFlags.c:1449
#4  0x080ee1e6 in initStatsFile (f=0x814e970) at rts/RtsFlags.c:1503
#5  0x080ecd63 in setupRtsFlags (argc=0x814b5a4, argv=0x80479cc, rtsOptsEnabled=RtsOptsAll, ghc_rts_opts=0x0)
    at rts/RtsFlags.c:556
#6  0x080ec414 in hs_init_ghc (argc=0x814b5a4, argv=0x814b5a8, rts_config=...) at rts/RtsStartup.c:156
#7  0x080defb9 in real_main () at rts/RtsMain.c:47
#8  0x080df09d in hs_main (argc=3, argv=0x80479cc, main_closure=0x814682c, rts_config=...) at rts/RtsMain.c:114
#9  0x080804d2 in main ()

comment:8 Changed 5 years ago by maeder

it works without file name:

-bash-3.00$ ./W +RTS -t
<<ghc: 47444 bytes, 1 GCs, 42632/42632 avg/max bytes residency (1 samples), 1M in use, 0.00 INIT (0.00 elapsed), 0.00 MUT (0.00 elapsed), 0.00 GC (0.00 elapsed) :ghc>>

comment:9 Changed 5 years ago by maeder

The -t argument file is actually created, but remains empty.

comment:10 Changed 5 years ago by maeder

Under linux I see a trailing "(null)" in the printed command line within the -t file.

> cat test
./Hello +RTS -ttest --machine-readable (null) 
 [("bytes allocated", "47628")
 ,("num_GCs", "1")
 ,("average_bytes_used", "42632")
 ,("max_bytes_used", "42632")
 ,("num_byte_usage_samples", "1")
 ,("peak_megabytes_allocated", "1")
 ,("init_cpu_seconds", "0.00")
 ,("init_wall_seconds", "0.00")
 ,("mutator_cpu_seconds", "0.00")
 ,("mutator_wall_seconds", "-0.00")
 ,("GC_cpu_seconds", "0.00")
 ,("GC_wall_seconds", "0.00")

comment:11 Changed 5 years ago by maeder

Architecture: x86Unknown/Multiple

the same seq-faults occurs under sparc solaris

comment:12 Changed 5 years ago by igloo

Component: CompilerRuntime System
Milestone: 7.6.2
Priority: normalhighest

Sounds like an off-by-one error. Thanks for the diagnosis.

comment:13 Changed 5 years ago by simonmar

Owner: set to simonmar

I see the problem, fix coming soon. Thanks for all the debugging.

comment:14 Changed 5 years ago by marlowsd@…

commit 5f01b6dd095955e9a52f5624213a7c54dc5e1a8c

Author: Simon Marlow <>
Date:   Tue Sep 11 16:12:52 2012 +0200

    Fix off-by-one (#7227)

 rts/RtsFlags.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

comment:15 Changed 5 years ago by simonmar

Status: newmerge
Test Case: rts/T7227

comment:16 Changed 5 years ago by igloo

Resolution: fixed
Status: mergeclosed

comment:17 Changed 5 years ago by PHO

Cc: pho@… added
Note: See TracTickets for help on using tickets.