1 Title: Trying CDGC HOWTO
2 Tags: en, d, gc, dgc, cdgc, howto, patch, tango, dmd, makefile
4 Here are some details on how to try CDGC, as it needs a very particular setup,
5 specially due to DMD__ not having `precise heap scanning`__ integrated yet.
7 __ http://www.dsource.org/projects/dmd
8 __ http://d.puremagic.com/issues/show_bug.cgi?id=3463
10 Here are the steps (in some kind of literate__ scripting, you can copy&paste to
13 __ http://en.wikipedia.org/wiki/Literate_programming
17 # You probably want to do all this mess in some subdirectory :)
21 # First, checkout the repositories.
22 git clone git://git.llucax.com.ar/software/dgc/cdgc.git
23 # If you have problems with git:// URLs, try HTTP:
24 # git clone https://git.llucax.com.ar/r/software/dgc/cdgc.git
25 svn co http://svn.dsource.org/projects/tango/tags/releases/0.99.9 tango
27 # DMD doesn't care much (as usual) about tags, so you have to use -r to
28 # checkout the 1.063 revision (you might be good with the latest revision
30 svn co -r613 http://svn.dsource.org/projects/dmd/branches/dmd-1.x dmd
32 # Now we have to do some patching, let's start with Tango (only patch 3 is
33 # *really* necessary, but the others won't hurt).
35 for p in 0001-Fixes-to-be-able-to-parse-the-code-with-Dil.patch \
36 0002-Use-the-mutexattr-when-initializing-the-mutex.patch \
37 0003-Add-precise-heap-scanning-support.patch \
38 0004-Use-the-right-attributes-when-appending-to-an-empty-.patch
40 wget -O- "##POST_URL##/10-trying-cdgc-howto/$p" |
47 p=0001-Create-pointer-map-bitmask-to-allow-precise-heap-sca.patch
48 wget -O- "##POST_URL##/10-trying-cdgc-howto/$p" |
51 # Since we are in the DMD repo, let's compile it (you may want to add -jN if
52 # you have N CPUs to speed up things a little).
53 make -C src -f linux.mak
56 # Good, now we have to wire Tango and CDGC together, just create a symbolic
59 ln -s ../../../../../cdgc/rt/gc/cdgc tango/core/rt/gc/
61 # Since I don't know very well the Tango build system, I did a Makefile of my
62 # own to compile it, so just grab it and compile Tango with it. It will use
63 # the DMD you just compiled and will compile CDGC by default (you can change
64 # it via the GC Make variable, for example: make GC=basic to compile Tango
65 # with the basic GC). The library will be written to obj/libtango-$GC.a, so
66 # you can have both CDGB and the basic collector easily at hand):
67 wget ##POST_URL##/10-trying-cdgc-howto/Makefile
68 make # Again add -jN if you have N CPUs to make a little faster
70 # Now all you need now is a decent dmd.conf to put it all together:
72 echo "[Environment]" > dmd/src/dmd.conf
73 echo -n "DFLAGS=-I$PWD/tango -L-L$PWD/tango/obj " >> dmd/src/dmd.conf
74 echo -n "-defaultlib=tango-cdgc " >> dmd/src/dmd.conf
75 echo "-debuglib=tango-cdgc -version=Tango" >> dmd/src/dmd.conf
77 # Finally, try a Hello World:
79 import tango.io.Console;
83 Cout("Hello, World").newline;
86 dmd/src/dmd -run hello.d
88 # If you don't trust me and you want to be completely sure you have CDGC
89 # running, try the collect_stats_file option to generate a log of the
91 D_GC_OPTS=collect_stats_file=log dmd/src/dmd -run hello.d
97 If you want to make this DMD the default, just add dmd/src to the PATH
98 environment variable or do a proper installation ;)
100 Let me know if you hit any problem...
103 .. vim: set et sw=3 sts=3 :