FreeBSD/amd64 port: more progress

Gregory Wright gwright at
Thu Mar 15 11:13:02 EDT 2007

Hi Ian,

I'm building ghc-6.6.20070314 using the unregisterized ghc-6.4.2.
(BTW, the unregisterized 6.4.2 seems quite reliable.  I was able to
build happy-1.15 and alex-2.0.1 without any problem.)

I configured 6.6.20070314 for debugging by putting

SRC_HC_OPTS+=-debug -L/usr/local/lib
EXTRA_LD_OPTS=-L/usr/local/lib -lbfd -liberty

in mk/  With debugging turned on, the new 6.6
no longer hangs when compiling rts/Linker.c, rather the new
6.6 ghc-inplace fails compiling the first file it tries, Adjustor.c.

I was running "top -u" in another window and when the build
failed the memory used went unprintably high (i.e., "top" couldn't
print it, nor could you print what I said when I noticed this).

I was able to re-run the failed compilation under gdb.  I added
"-v" to ghc's command line.  The big slowdown seemed to occur while
ghc-inplace was generating the command line for the c compiler.
This is when I interrupted it.  From gdb:

(gdb) run -B/tmp/ghc -optc-O -optc-Wall -optc-W -optc-Wstrict- 
prototypes -optc-Wmissing-prototypes -optc-Wmissing-declarations - 
optc-Winline -optc-Waggregate-return -optc-Wbad-function-cast -optc- 
I../includes -optc-I. -optc-Iparallel -optc-DCOMPILING_RTS -optc- 
fomit-frame-pointer -optc-optc-g -optc-DNOSMP -optc-I/usr/local/ 
include -optc-fno-strict-aliasing -H16m -O -debug -L/usr/local/lib - 
optc-O2 -optc-DDEBUG -optc-DNOSMP -static -I/usr/local/include -I. - 
#include HCIncludes.h -fvia-C -dcmm-lint -v    -c Adjustor.c -o  
Starting program: /tmp/ghc/compiler/stage1/ghc-6.6.20070314 -B/tmp/ 
ghc -optc-O -optc-Wall -optc-W -optc-Wstrict-prototypes -optc- 
Wmissing-prototypes -optc-Wmissing-declarations -optc-Winline -optc- 
Waggregate-return -optc-Wbad-function-cast -optc-I../includes -optc- 
I. -optc-Iparallel -optc-DCOMPILING_RTS -optc-fomit-frame-pointer - 
optc-optc-g -optc-DNOSMP -optc-I/usr/local/include -optc-fno-strict- 
aliasing -H16m -O -debug -L/usr/local/lib -optc-O2 -optc-DDEBUG -optc- 
DNOSMP -static -I/usr/local/include -I. -#include HCIncludes.h -fvia- 
C -dcmm-lint -v    -c Adjustor.c -o Adjustor.o
Glasgow Haskell Compiler, Version 6.6.20070314, for Haskell 98,  
compiled by GHC version 6.4.2
Using package config file: /tmp/ghc/driver/package.conf.inplace
wired-in package base not found.
wired-in package rts mapped to rts-1.0
wired-in package haskell98 not found.
wired-in package template-haskell not found.
Hsc static flags: -funregisterised -static -static
Created temporary directory: /tmp/ghc27577_0
*** C Compiler:
gcc -x c Adjustor.c -o /tmp/ghc27577_0/ghc27577_0.s -v -S -Wimplicit - 
W -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations - 
Winline -Waggregate-return -Wbad-function-cast -I../includes -I. - 
Iparallel -DCOMPILING_RTS -fomit-frame-pointer -optc-g -DNOSMP -I/usr/ 
local/include -fno-strict-aliasing -O2 -DDEBUG -DNOSMP -I /usr/local/ 
include -I . -I /tmp/ghc/includes -fwrapv
Using built-in specs.
Configured with: FreeBSD/amd64 system compiler
Thread model: posix
gcc version 3.4.6 [FreeBSD] 20060305
/usr/libexec/cc1 -quiet -v -I../includes -I. -^C
Program received signal SIGINT, Interrupt.
0x00000000015b56f3 in findMBlockMap (p=0x3a242700000) at MBlock.c:68
68          for( i = 0; i < mblock_map_count; i++ )
(gdb) bt
#0  0x00000000015b56f3 in findMBlockMap (p=0x3a242700000) at MBlock.c:68
#1  0x00000000015b574b in markHeapAlloced (p=0x3a242700000) at  
#2  0x00000000015b59df in getMBlocks (n=262145) at MBlock.c:280
#3  0x00000000015ac617 in allocMegaGroup (n=262145) at BlockAlloc.c:174
#4  0x00000000015ac3e0 in allocGroup (n=67108865) at BlockAlloc.c:72
#5  0x000000000159e24a in allocate (n=34359738372) at Storage.c:504
#6  0x000000000159e439 in allocatePinned (n=34359738372) at Storage.c: 
#7  0x00000000015a1376 in newPinnedByteArrayzh_fast ()
#8  0x000000000159d3e2 in StgRun (f=0x15a1330  
     basereg=0x3a2) at StgCRun.c:93
#9  0x00000000015990f3 in schedule (mainThread=0x2164080,
     initialCapability=0x3a2) at Schedule.c:932
#10 0x0000000001599edd in waitThread_ (m=0x2164080,  
     at Schedule.c:2156
#11 0x0000000001599dd3 in scheduleWaitThread (tso=0x801dc0000, ret=0x0,
     initialCapability=0x0) at Schedule.c:2050
#12 0x00000000015959b1 in rts_evalLazyIO (p=0x1931270, ret=0x0) at  
#13 0x000000000159521f in main (argc=1114636288, argv=0x3a2) at  
(gdb) f 0
#0  0x00000000015b56f3 in findMBlockMap (p=0x3a242700000) at MBlock.c:68
68          for( i = 0; i < mblock_map_count; i++ )

Looks like someone is asking for too much memory (n=34359738372)!

I've taken a cursory look at this, but I wanted to send a note in  
case you
know what is wrong off the top of your head.

I'll be away next week so I won't be able to easily test things on my  
amd64 box.
I will be able to look at code, if you can point me to the right  
places.  (Should I be
looking at 6.4.2/6.6 differences in Storage.c or Schedule.c?)

Best Wishes,

More information about the Glasgow-haskell-users mailing list