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

Tango on 64bit Linux

Moderators: larsivi kris

Posted: 05/14/07 19:58:11 Modified: 05/14/07 19:58:35

Hello all,

First of all, I managed to get Tango compiled and installed without to much of a hassle and also got rebuild going, however, there is something of an issue with varargs. The following code:

void main()

{
    int[] samples = ([47, 51, 50, 48, 50, 50, 52, 49, 54, 43].dup).sort;
    int[] inRange = samples[samples.lbound( 50 ) .. samples.ubound( 50 )];

    foreach( i, s; samples )
        Stdout( i )( " = " )( s ).newline;
    Stdout.newline;
    Stdout( "There were " )( inRange.length )( " matches: " );
    foreach( i, s; inRange )
        Stdout ( s )( ' ' );
    Stdout.newline;
}

Doesn't compile properly using GDC, now I don't know whether this is a GDC issue or a Tango issue, though it looks to be a tango issue. This is the output of the compilation:

$ rebuild mytestprogram.d
WARNING: Module mytestprogram.d does not have a module declaration. This can cau
se problems
         with rebuild's -oq option. If an error occurs, fix this first.
/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.1.1/../../../../include/d/4.1.1/t
ango/io/Print.d:120: function tango.text.convert.Layout.Layout!(char).Layout.con
vert (char[],...) does not match parameter types (uint delegate(char[]),TypeInfo
[],ubyte[24][1],char[])
/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.1.1/../../../../include/d/4.1.1/t
ango/io/Print.d:120: Error: cannot implicitly convert expression (_argptr) of ty
pe ubyte[24][1] to char*
/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.1.1/../../../../include/d/4.1.1/t
ango/io/Print.d:132: function tango.text.convert.Layout.Layout!(char).Layout.con
vert (char[],...) does not match parameter types (uint delegate(char[]),TypeInfo
[],ubyte[24][1],char[])
/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.1.1/../../../../include/d/4.1.1/t
ango/io/Print.d:132: Error: cannot implicitly convert expression (_argptr) of ty
pe ubyte[24][1] to char*
/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.1.1/../../../../include/d/4.1.1/t
ango/io/Print.d:165: function tango.text.convert.Layout.Layout!(char).Layout.con
vert (char[],...) does not match parameter types (uint delegate(char[]),TypeInfo
[],ubyte[24][1],char[])
/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.1.1/../../../../include/d/4.1.1/t
ango/io/Print.d:165: Error: cannot implicitly convert expression (_argptr) of ty
pe ubyte[24][1] to char*
/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.1.1/../../../../include/d/4.1.1/t
ango/text/convert/Layout.d:129: function tango.text.convert.Layout.Layout!(char)
.Layout.convert (char[],...) does not match parameter types (TypeInfo[],ubyte[24
][1],char[])
/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.1.1/../../../../include/d/4.1.1/t                            ango/text/convert/Layout.d:129: Error: cannot implicitly convert expression 
(_arguments) of type TypeInfo[] to uint delegate(char[])
/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.1.1/../../../../include/d/4.1.1/t                            ango/text/convert/Layout.d:129: Error: cannot implicitly convert expression 
(_argptr) of type ubyte[24][1] to TypeInfo[]
/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.1.1/../../../../include/d/4.1.1/t                            ango/text/convert/Layout.d:129: Error: cannot implicitly convert expression 
(formatStr) of type char[] to char*
/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.1.1/../../../../include/d/4.1.1/t                            ango/text/convert/Layout.d:129: Error: expected 4 arguments, not 3
/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.1.1/../../../../include/d/4.1.1/t                            ango/text/convert/Layout.d:129: Error: cannot implicitly convert expression ((th                            is.convert)(cast(uint delegate(char[]))_arguments,cast(TypeInfo[])_argptr,cast(char*)formatStr)) of type uint to char[]
/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.1.1/../../../../include/d/4.1.1/t                            ango/text/convert/Layout.d:138: function tango.text.convert.Layout.Layout!(char).Layout.convert (char[],...) 
does not match parameter types (uint delegate(char[]),TypeInfo[],ubyte[24][1],char[])
/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.1.1/../../../../include/d/4.1.1/t                            ango/text/convert/Layout.d:138: Error: cannot implicitly convert expression 
(_argptr) of type ubyte[24][1] to char*


Any suggestions?

Sjoerd

How C++ became ancient

Author Message

Posted: 05/14/07 20:13:10

It is somewhat undecided yet, but if it's a Tango issue, then D is too limited for what Tango do.

The problem is that varargs are implemented differently on x86 and x86_64/PPC, making the formatter's use of varargs not work. We have requested from David that he implements this uniformely over all platforms supported by GDC, and in the same manner as on x86 (or at least that what is possible today on x86 (indexing into the varargs) also becomes possible on all other platforms).

Posted: 05/14/07 20:21:11

Ok, I've done a bit of research. One of the functions:

public final uint convert (Sink sink, TypeInfo[] arguments, Arg args, T[] formatStr)

in reality is accepting a delegate with char[] as argument (Sink) and args is resolved as char*, however, args gets ubyte[24][1], which quite obviously is not going to work properly. It is quite consistent with the char* and ubyte[24][1] mismatch, however, I don't have a clue where the ubyte[24][1] comes from.

Sjoerd

How C++ became ancient

Posted: 05/14/07 20:41:44

We've researched this fairly much ourselves, you're far from the first running into the problem sadly. I think it is understood pretty well, and probably not cleanly solvable without changes to GDC.

Posted: 05/15/07 08:58:01

Yeah, GDC and DMD are incompatible in this area. GDC does what it does because Phobos needs to compile cleanly, regardless of what the D doc actually says. That is, a couple of old Phobos modules appear to be outside of the published D spec. David is looking into it.

Posted: 05/15/07 18:14:04 -- Modified: 05/15/07 18:20:06 by
svanleent -- Modified 2 Times

Thanks for the replies.

I hope I can get it to work if things are worked out. I'd like to port one of the GUI libraries (hopefully by that time, the D community will be able to pick one and stick to it). DWT is being build, but also DFL and DUI are still in the race.

bit off topic: I think it would be better if we'd stick our heads together and don't start 3 or 4 half build gui libraries, but one good, ideally have it defined as a special tango library.

Sjoerd

Posted: 05/16/07 15:46:43

svanleent wrote:

bit off topic: I think it would be better if we'd stick our heads together and don't start 3 or 4 half build gui libraries, but one good, ideally have it defined as a special tango library.

FWIW, I've noticed that the real sticking point for these GUI libs, aside from completeness, is portability. You probably could harvest the OS-GUI bindings from several of Beta and Alpha quality libs and combine them into one framework. Once you have clipboard support, drag-and-drop, event management and widget rendering worked out, the rest would practically write itself.

Another option that's been tossed about is to go with OpenGL for rendering backed by minimal OS bindings for clipboard and drag-and-drop. That's the longest way around, but it has the most potential for quality results. Again, the OS specific stuff can probably be harvested from all the other GUI libs out there right now.

-- EricAnderton at yahoo