[jhc] Garbage collector on OS X

Max Bolingbroke batterseapower at hotmail.com
Sun Jul 11 04:48:14 EDT 2010


Hi,

The garbage collector doesn't appear to work on OS X due to a linking
error. For a trivial "hello world" program I get the following output
from JHC:

"""
$ jhc  -fjgc Example.hs
jhc -fjgc Example.hs
jhc 0.7.4 (tokfekyuvi-27)
Finding Dependencies...
Using Ho Cache: '/Users/mbolingbroke/.jhc/cache'
Main                    [Example.hs]
<~/.jhc/cache/39891df74647a2bf36dd845a4c48ee8a.ho>
Fresh: <~/.jhc/cache/39891df74647a2bf36dd845a4c48ee8a.ho>
Typechecking...
Compiling...
Collected Compilation...
-- typeAnalyzeMethods
-- BoxifyProgram
-- Boxy WorkWrap
-- LambdaLift
E
├─case: 27
├─case-alt: 33
├─lambda: 16
├─let-binding: 19
├─lit: 66
├─other: 29
├─prim: 14
└─var-use: 82
Converting to Grin...
Found 0 CAFs to convert to constants, 0 of which are recursive.
Recursive

Constant

CAFS

Writing "hs.out_code.c"
Running: gcc '-std=gnu99' -D_GNU_SOURCE '-falign-functions=4'
-ffast-math -Wextra -Wall -Wno-unused-parameter -o hs.out
hs.out_code.c -DNDEBUG -O3 '-D_JHC_GC=_JHC_GC_JGC'
hs.out_code.c:220:1: warning: "ALIGN" redefined
In file included from /usr/include/machine/param.h:37,
                 from /usr/include/sys/param.h:110,
                 from hs.out_code.c:143:
/usr/include/i386/param.h:83:1: warning: this is the location of the
previous definition
hs.out_code.c: In function ‘gc_check_heap’:
hs.out_code.c:1606: warning: comparison of distinct pointer types lacks a cast
hs.out_code.c:1606: warning: comparison of distinct pointer types lacks a cast
hs.out_code.c: At top level:
hs.out_code.c:1642: warning: ‘gc_add_root’ defined but not used
Undefined symbols:
  "__end", referenced from:
      _gc_alloc in ccFhQDIs.o
      _gc_alloc in ccFhQDIs.o
      _gc_alloc in ccFhQDIs.o
  "__start", referenced from:
      _gc_alloc in ccFhQDIs.o
      _gc_alloc in ccFhQDIs.o
      _gc_alloc in ccFhQDIs.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
jhc: user error (C code did not compile.)
"""

Cheers,
Max


More information about the jhc mailing list