Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Getting started with GDC and Tango - fails with apparent bug

Moderators: larsivi kris

Posted: 06/14/08 06:18:37

I'm trying to follow the tango build directions, have checked out tango 0.99.6 and tried to run lib/

The script fails, here is the tail of the console transcript:

(I've inserted newlines into the preformatted transcript text below, because the wiki software widens everything in this post to the width of the longest preformatted line, making it quite hard to read without the added newlines.)

gmake[1]: Leaving directory `/big/Download/gdc/tango-src/0.99.6/lib/gc/basic'

/usr/bin/gmake -C common/tango -fposix.mak lib CC=gcc DC=gdmd ADD_DFLAGS="-q,-nostdinc -I`pwd`/common -I`pwd`/..
 -I`pwd`/compiler/gdc" ADD_CFLAGS=""

gmake[1]: Entering directory `/big/Download/gdc/tango-src/0.99.6/lib/common/tango'

gdmd -c -release -O -inline -w -nofloat -version=Posix -q,-nostdinc -I/home/parz/Download/gdc/tango-src/0.99.6/lib/common 
-I/home/parz/Download/gdc/tango-src/0.99.6/lib/.. -I/home/parz/Download/gdc/tango-src/0.99.6/lib/compiler/gdc 
-Hfcore/BitManip.di core/BitManip.d -ofcore/BitManip.o

gdmd -c -release -O -inline -w -nofloat -version=Posix -q,-nostdinc -I/home/parz/Download/gdc/tango-src/0.99.6/lib/common 
-I/home/parz/Download/gdc/tango-src/0.99.6/lib/.. -I/home/parz/Download/gdc/tango-src/0.99.6/lib/compiler/gdc 
-Hfcore/Exception.di core/Exception.d -ofcore/Exception.o

gdmd -c -release -O -inline -w -nofloat -version=Posix -q,-nostdinc -I/home/parz/Download/gdc/tango-src/0.99.6/lib/common 
-I/home/parz/Download/gdc/tango-src/0.99.6/lib/.. -I/home/parz/Download/gdc/tango-src/0.99.6/lib/compiler/gdc 
-Hfcore/Memory.di core/Memory.d -ofcore/Memory.o

gdmd -c -release -O -inline -w -nofloat -version=Posix -q,-nostdinc -I/home/parz/Download/gdc/tango-src/0.99.6/lib/common 
-I/home/parz/Download/gdc/tango-src/0.99.6/lib/.. -I/home/parz/Download/gdc/tango-src/0.99.6/lib/compiler/gdc 
-Hfcore/Runtime.di core/Runtime.d -ofcore/Runtime.o

gdmd -c -release -O -inline -w -nofloat -version=Posix -q,-nostdinc -I/home/parz/Download/gdc/tango-src/0.99.6/lib/common 
-I/home/parz/Download/gdc/tango-src/0.99.6/lib/.. -I/home/parz/Download/gdc/tango-src/0.99.6/lib/compiler/gdc 
-Hfcore/Thread.di core/Thread.d -ofcore/Thread.o

gcc -c -O  core/ThreadASM.S -ocore/ThreadASM.o
gcc -c -O  stdc/wrap.c -ostdc/wrap.o

gdmd -c -release -O -inline -w -nofloat -version=Posix -q,-nostdinc -I/home/parz/Download/gdc/tango-src/0.99.6/lib/common 
-I/home/parz/Download/gdc/tango-src/0.99.6/lib/.. -I/home/parz/Download/gdc/tango-src/0.99.6/lib/compiler/gdc 
stdc/posix/pthread_darwin.d -ofstdc/posix/pthread_darwin.o

rm -f libtango-cc-tango.a
ar -qsv libtango-cc-tango.a core/BitManip.o core/Exception.o core/Memory.o core/Runtime.o core/Thread.o core/ThreadASM.o 
stdc/wrap.o stdc/posix/pthread_darwin.o
ar: creating libtango-cc-tango.a
ar: core/BitManip.o: No such file or directory
gmake[1]: *** [libtango-cc-tango.a] Error 1
gmake[1]: Leaving directory `/big/Download/gdc/tango-src/0.99.6/lib/common/tango'
gmake: *** [lib] Error 2
[parz@lobsang lib]$

It turns out that the gdmdcommand produces BitManip.o, but not in the core directory, rather the current make directory. The (makefile produced) gdmd command:

gdmd -c -release -O -inline -w -nofloat -version=Posix -q,-nostdinc -I/home/parz/Download/gdc/tango-src/0.99.6/lib/common 
-I/home/parz/Download/gdc/tango-src/0.99.6/lib/.. -I/home/parz/Download/gdc/tango-src/0.99.6/lib/compiler/gdc 
-Hfcore/BitManip.di core/BitManip.d -ofcore/BitManip.o

executes the following gdc command:

/big/Download/gdc/bin/gdc -frelease -O3 -fomit-frame-pointer -fweb -finline-functions -Wall -fversion=Posix -nostdinc 
-I /home/parz/Download/gdc/tango-src/0.99.6/lib/common -I /home/parz/Download/gdc/tango-src/0.99.6/lib/.. 
-I /home/parz/Download/gdc/tango-src/0.99.6/lib/compiler/gdc -c core/BitManip.d -o BitManip.o -fintfc 

with -o BitManip.o where it should have -o core/BitManip.o.

Further investigation showed that at line 333 of the gdmd script,

    if ( ! $link && !$header && $output_file ) {
	$outf = $output_file;
    } else {

the value of $header is 1, and therefore $outf is not set to $output_file, instead it is set to a file name, without directory, derived from the source file.

$header became 1 because of the assignment that was added by the patch (at line 190)

    } elsif ( $arg =~ m/^-Hf(.*)$/ ) {
        $header = 1;
	$header_file = $1;
    } elsif ( $arg eq '--help' ) {

given in the build directions. So, as far as I can tell, the patch introduces a bug that causes the build to fail. Of course it would also fail without the patch. And, since others have built tango with the patch, there is actually no bug, and I am hallucinating the build failure.

So can someone de-hallucinate me past this problem?

Author Message

Posted: 06/14/08 14:09:54

Maybe you stated this in an earlier post - but which version of GDC do you have installed now?

Posted: 06/14/08 14:46:17

[parz@lobsang bin]$ gdc --version
gdc (GCC) 4.1.2 20070214 (  (gdc 0.24, using dmd 1.020))
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO

[parz@lobsang bin]$       

Posted: 06/14/08 15:20:37

I think the problem with putting results in the wrong dir was a bug in GDC/gdmd wrapper script - it is possible that a newer GDC will work better. Note that the Tango team doesn't consider 0.24 a usable version of GDC, and thus our downloads includes a later version compiled from GDC trunk.

Posted: 06/15/08 01:08:59

Actually, the tango binary download silently replaced GDC 0.24 with an earlier version, GDC 0.23. For some reason (mixed version installation?) that didn't work at all, the most simple program failed to find its imports. Thats how I got into trying to compile tango. If its really true that GDC 0.24 doesn't work with tango, I think it might be appropriate to say so in the build instructions, rather than posting a (buggy) patch to gdmd specifically for that unsuitable version.

Anyhow, I can see I'm in over my head with this. I want to learn D by re-implementing on my Linux machine, a program I have that is currently written in python. Tango looks like the better library, and I thought I might as well start off using it from the get-go. I imagined installing tango would be straightforward, but it is turning out to be a significant distraction, so I think I'll just back out, and use the phobos library.

Thanks a lot for your very prompt attention to my questions, larsivi and kris, and good luck with Tango.

Posted: 06/15/08 17:55:05

Then I need to ask which download did you try? 0.23 hasn't been an option in our downloads for a long time.

And yes, the documentation probably could be better, but things change fast and there is a lot of information to keep up to date. If you doulc be more specific on where you find it failing, please tell us. The reason for there being workarounds for 0.24 is that it used to work for earlier versions of Tango on a basic x86 system.

Posted: 06/16/08 17:09:35

Yeah, I understand. Anything you write about software quickly gets out of date. I'm sorry if my remark seemed to have a prickly tone.

I cant be sure: it was the GCJ no Dsss "bundle" downloaded June 12, it installed over my earlier GCJ (gdc 0.24) installeation. I have since deleted that shell archive.

However, just now, I tried this:

1. Completely deleted my current GCJ installation, including all earlier tango installed/built files.

2. Downloaded

3. Executed that, supplying /home/parz/Download/gdc as the install directory. Result:

[parz@lobsang gdc]$ which gdc
[parz@lobsang gdc]$ gdc --version
gdc (GCC) 4.1.2 20070214 ( gdc 0.24, using dmd 1.024)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO

[parz@lobsang gdc]$

So the gdc version in the bundle is the unsuitable 0.24 version, I believe it is the exact version I had earlier when I had installed GCJ separately.

And it does seem to be unsuitable, for, when I try to compile a tango console I/O program:

[parz@lobsang gdc]$ cd '/home/parz/gdc'
[parz@lobsang gdc]$ gdc -o tgc tango_console.d
tango_console.d:1: module Console cannot read file 'tango/io/Console.d'
[parz@lobsang gdc]$ cat tango_console.d

void    main()
   char []      str;

   Cout("Hi There!").newline;
   Cout(" What's your name? ").flush;

   str = Cin.get();

   Cout("Well, hello, ")(str).newline;
[parz@lobsang gdc]$

The unreadable Console.d file is not present, although a corresponding Console.di is present:

ls /home/parz/Download/gdc/include/d/tango/io
archive/    Console.di        FileConst.di  FileScan.di      model/     selector/    UnicodeFile.di
Buffer.di   DeviceConduit.di  File.di       FileSystem.di    Path.di    Stdout.di    vfs/
compress/   digest/           FilePath.di   GrowBuffer.di    Print.di   stream/
Conduit.di  FileConduit.di    FileRoots.di  MappedBuffer.di  protocol/  TempFile.di
[parz@lobsang gdc]$

Posted: 06/16/08 17:39:58

I am sorry, but it turns out our GDC downloads isn't perfectly named/versioned - so the gist of it is:

  • GDC 0.24 with DMD 1.020 (as you had earlier in the thread) - old and unsuitable.
  • GDC 0.24 with DMD 1.024 as in your latest post, much newer and suitable (should have been 0.25 pre-release)

Posted: 06/16/08 19:11:24

OK, can you please explain why that console i/o program will not compile successfully? (see my previous post)

It seems from the error message, that the compiler expects *.d files to be available for imports, but (only) *.di files are actually installed. Or else the compiler is not looking in the right directories.

Posted: 06/16/08 19:44:39

It will complain about missing *.d files, but it does accept corresponding *.di files if present. So the issue here is that GDC does not find the Tango files.

But as you installed DSSS alongside GDC, could you try compiling your sample with that instead?

dsss build tango_console.d

DSSS should take care of passing the necessary arguments/paths, and if it works, it should tell you what is missing from your own command line and/or configuration.

Posted: 06/16/08 20:12:08

All those .di files are the result of some build-tool going awry ... Tango does not ship with those .di files (only a handful in tango.core and tango.sys.win32)

Posted: 06/16/08 20:38:10

No, nothing awry, just a standard DSSS install (which probably would make it rather inconvenient to not use DSSS now that I think of it).

Posted: 06/17/08 05:10:27

OK, it compiles with dsss:

[parz@lobsang gdc]$ dsss build tango_console.d
tango_console.d => tango_console
+ /home/parz/Download/gdc/bin/rebuild -Idsss_imports/ -I. -S./ -I/home/parz/Download/gdc/include/d -S/home/parz/Download/gdc/lib/  -I/home/parz/Download/gdc/include/d -S/home/parz/Download/gdc/lib -I/home/parz/d/include/d -S/home/parz/d/lib  -oqdsss_objs/G  tango_console.d -oftango_console
WARNING: Module tango_console.d does not have a module declaration. This can cause problems
         with rebuild's -oq option. If an error occurs, fix this first.

[parz@lobsang gdc]$ ./tango_console
Hi There!
 What's your name? woff
Well, hello, woff
[parz@lobsang gdc]$

But its a black art!

Posted: 06/17/08 05:38:17

I agree. Would be great if someone could come up with a way to make an installation entirely painless on Linux

Posted: 06/17/08 06:37:58

With DSSS you buy into a concept that works surprisingly well, but that put some limitiations on how it is practical to build your software. It is not really black art, but a whole lot of prepared config files. GDC is unfortunately somewhat complex to set up properly because it half of the time really should be set up by the distro instead. DMD is much easier in that regard because we always have full control.

See here for more information on DSSS.