Compiling DMD parser?

Markus Koskimies markus at reaaliaika.net
Mon Jul 14 03:30:02 PDT 2008


On Mon, 14 Jul 2008 04:07:00 +0000, Markus Koskimies wrote:

> At the same time I'll try to get dil compiled; although dil does not
> generate code, it might still be a suitable platform to write a software
> to generate some common warnings (just for my personal use, I'm not
> intended to start to write "dlint"). Unfortunately it means that I need
> to figure out how those DSSS & Tango things work :)

I finally made it, but that was extremely hard :D Now dil compiles \o/

I'm not sure where to tell these findings, so I write them here; 
hopefully someone finds them with google, if he/she enters same 
problems...

DSSS, GDC, Tango and Linux-AMD64:

---

First thing to know is that currently GDC (nor DMD) does not work 
completely with 64-bit Linuxes. Everything else seems to work, but not 
vararg's (that is, writef & writefln).

So, install a chroot'ed 32-bit environment, instructions:

http://saftsack.fs.uni-bayreuth.de/~dun3/archives/using-a-x86-chroot-to-
run-32-bit-apps-on-debian-amd64/94.html

---

You may install DMD, it does not cause any harm :)

---

Second thing; if you followed those instructions, Debian sid comes with 
newer GCC than is supported by GDC. So don't install it (it may work, but 
better to use correct version)! Install first GDC (currently GDC-4.1), 
and install the same version of GCC and G++ (4.1).

Try to compile a simple hello.d with GDC to check, that it really works. 
With correct versions of all necessary things (gcc, g++, gdc and their 
libraries & utils), gdc should work OK.

---

Next thing to install is DSSS. It should work also, quite easily. Make it 
use GDC (to be able to build tango with GDC). I was not able to install 
curl to chrooted sid, so I'm not able to use dsss net installs.

---

When you have GDC and DSSS working, you can try to get tango working. I 
fought with tango for several hours. I don't really know what phase 
didn't work, but here are something:

* I tried both dsss build/install, and build/install scripts in tango 
package (currently 0.99.6). Both seemed to work (no errors), but GDC 
didn't build my simple tango-hello.d; there were continuously error 
messages like:

hello.o: In function `_Dmain':
hello.d:(.text+0x20): undefined reference to 
`_D5tango2io7Console4CoutC5tango2io7Console7Console6Output'
hello.d:(.text+0x2f): undefined reference to 
`_D5tango2io7Console7Console6Output6appendMFAaZC5tango2io7Console7Console6Output'
hello.d:(.text+0x3b): undefined reference to 
`_D5tango2io7Console7Console6Output7newlineMFZC5tango2io7Console7Console6Output'
hello.o:(.data+0x38): undefined reference to 
`_D5tango2io7Console12__ModuleInfoZ'

There were probably two reasons for this:

1) libgphobos.a in /usr/lib/gcc/i486-linux-gnu/4.1.3/ was probably 
incorrectly build, and I didn't notice to update it.

2) It seems, that libDG-tango-core.a does not include all the necessary 
files. I ran "ar r libDG-tango-core.a *.o" in tango/ directory (where the 
libDG* files are), since there was object files like 
tango.core.Exception.o), which were not in that core library.

---

* In tango directory, use script:

./build-tango.sh gdc

...To build libgtango.a, which you copy to correct location (good guess: /
usr/lib/gcc/i486-linux-gnu/4.1.3/)

* It could be easier first to try to get plain gdc builds to work:

$ gdmd -version=Posix tango-hello.d -ofhello -W-lgtango

---

Now when I got those things working, I'm not going to uninstall them and 
try again, so I can't tell step-by-step instructions for getting them 
working ;D



More information about the Digitalmars-d mailing list