Thread overview
tango and gdc
Aug 16, 2007
Jason House
Aug 16, 2007
Carlos Santander
Aug 16, 2007
Jason House
Aug 17, 2007
Lars Noschinski
Aug 17, 2007
Carlos Santander
Aug 17, 2007
Lars Ivar Igesund
Aug 17, 2007
Lars Noschinski
August 16, 2007
Under linux, I have gotten past compilation issues with -fversion=Posix, but I fail to link.  Any ideas on what could be going wrong?

$ gdc -fversion=Posix -w -g *.d -o housebot-0.6.gdc -I /import/ -ltango
/home/jhouse/tmp/cceVjUiy.o: In function `_Dmain':
/home/jhouse/Documents/go/housebot-0.6/housebot.d:259: undefined reference to `_D3std2gc7disableFZv'
/bin/../lib/gcc/i686-pc-linux-gnu/4.1.1/../../../libtango.a(tango.util.time.StopWatch.o): In function `_D5tango4util4time9StopWatch9StopWatch4stopMFZf':
tango/util/time/StopWatch.d:(.gnu.linkonce.t_D5tango4util4time9StopWatch9StopWatch4stopMFZf+0x17): undefined reference to `__U64_LDBL'
/bin/../lib/gcc/i686-pc-linux-gnu/4.1.1/../../../libtango.a(tango.util.time.StopWatch.o): In function `_D5tango4util4time9StopWatch9StopWatch5timerFZm':
tango/util/time/StopWatch.d:(.gnu.linkonce.t_D5tango4util4time9StopWatch9StopWatch5timerFZm+0x4f): undefined reference to `_d_throw@4'
/bin/../lib/gcc/i686-pc-linux-gnu/4.1.1/../../../libtango.a(tango.math.Math.o): In function `_D5tango4math4Math4asinFcZc':
tango/math/Math.d:(.gnu.linkonce.t_D5tango4math4Math4asinFcZc+0x26): undefined reference to `_Cmul'
etc...
August 16, 2007
Jason House escribió:
> Under linux, I have gotten past compilation issues with -fversion=Posix, but I fail to link.  Any ideas on what could be going wrong?
> 
> $ gdc -fversion=Posix -w -g *.d -o housebot-0.6.gdc -I /import/ -ltango
> /home/jhouse/tmp/cceVjUiy.o: In function `_Dmain':
> /home/jhouse/Documents/go/housebot-0.6/housebot.d:259: undefined reference to `_D3std2gc7disableFZv'
> /bin/../lib/gcc/i686-pc-linux-gnu/4.1.1/../../../libtango.a(tango.util.time.StopWatch.o): In function `_D5tango4util4time9StopWatch9StopWatch4stopMFZf':
> tango/util/time/StopWatch.d:(.gnu.linkonce.t_D5tango4util4time9StopWatch9StopWatch4stopMFZf+0x17): undefined reference to `__U64_LDBL'
> /bin/../lib/gcc/i686-pc-linux-gnu/4.1.1/../../../libtango.a(tango.util.time.StopWatch.o): In function `_D5tango4util4time9StopWatch9StopWatch5timerFZm':
> tango/util/time/StopWatch.d:(.gnu.linkonce.t_D5tango4util4time9StopWatch9StopWatch5timerFZm+0x4f): undefined reference to `_d_throw@4'
> /bin/../lib/gcc/i686-pc-linux-gnu/4.1.1/../../../libtango.a(tango.math.Math.o): In function `_D5tango4math4Math4asinFcZc':
> tango/math/Math.d:(.gnu.linkonce.t_D5tango4math4Math4asinFcZc+0x26): undefined reference to `_Cmul'
> etc...

I've had more luck getting Tango programs to compile with either Bud (as in the examples) or Rebuild.

-- 
Carlos Santander Bernal
August 16, 2007
Carlos Santander Wrote:
> I've had more luck getting Tango programs to compile with either Bud (as in the examples) or Rebuild.

My colleague on a mac gets the following with dsss (AKA rebuild).  Is this a generic issue or a mac issue?

$ dsss build
housebot.d => housebot-0.6
+ /Users/u/Programmieren/D/bin/rebuild -Idsss_imports/ -I. -S./ -I/
Users/u/Programmieren/D/include/d -S/Users/u/Programmieren/D/lib/   -
oqdsss_objs -Dddoc/ddoc -unittest -w -g housebot.d -ofhousebot-0.6
warning - /Users/u/Programmieren/D/tango/tango/math/IEEE.d:566:
Error: implicit conversion of expression (cast(int)((cast(short*)(&
x))[4u]) & 32767) of type int to short can cause loss of data
Command /Users/u/Programmieren/D/bin/rebuild returned with code 256,
aborting.

August 17, 2007
* Carlos Santander <csantander619@gmail.com> [07-08-16 07:00]:
>Jason House escribió:
>>Under linux, I have gotten past compilation issues with -fversion=Posix, but I fail to link.  Any ideas on what could be going wrong?
>>$ gdc -fversion=Posix -w -g *.d -o housebot-0.6.gdc -I /import/ -ltango
>>/home/jhouse/tmp/cceVjUiy.o: In function `_Dmain':
>>/home/jhouse/Documents/go/housebot-0.6/housebot.d:259: undefined reference to `_D3std2gc7disableFZv'
>>/bin/../lib/gcc/i686-pc-linux-gnu/4.1.1/../../../libtango.a(tango.util.time.StopWatch.o): In function `_D5tango4util4time9StopWatch9StopWatch4stopMFZf':
>>tango/util/time/StopWatch.d:(.gnu.linkonce.t_D5tango4util4time9StopWatch9StopWatch4stopMFZf+0x17): undefined reference to `__U64_LDBL'
>>/bin/../lib/gcc/i686-pc-linux-gnu/4.1.1/../../../libtango.a(tango.util.time.StopWatch.o): In function `_D5tango4util4time9StopWatch9StopWatch5timerFZm':
>>tango/util/time/StopWatch.d:(.gnu.linkonce.t_D5tango4util4time9StopWatch9StopWatch5timerFZm+0x4f): undefined reference to `_d_throw@4'
>>/bin/../lib/gcc/i686-pc-linux-gnu/4.1.1/../../../libtango.a(tango.math.Math.o): In function `_D5tango4math4Math4asinFcZc':
>>tango/math/Math.d:(.gnu.linkonce.t_D5tango4math4Math4asinFcZc+0x26): undefined reference to `_Cmul'
>>etc...
>
>I've had more luck getting Tango programs to compile with either Bud (as in the examples) or Rebuild.

Bud does not build with Tango, so I tried rebuild. It works, but builds
a lot of object files, probably one for each Tango class used. This is
somehow annoying and I wonder, if there should not a precompiled binary?

I installed Tango/GDC via the tango+gdc installer from the tango
website in /usr/local.
August 17, 2007
Lars Noschinski escribió:
> * Carlos Santander <csantander619@gmail.com> [07-08-16 07:00]:
>>
>> I've had more luck getting Tango programs to compile with either Bud (as in the examples) or Rebuild.
> 
> Bud does not build with Tango, so I tried rebuild. It works, but builds
> a lot of object files, probably one for each Tango class used. This is
> somehow annoying and I wonder, if there should not a precompiled binary?
> 
> I installed Tango/GDC via the tango+gdc installer from the tango
> website in /usr/local.

Regarding Bud, first you would have to build it using GPhobos, and then switch to Tango.

Both Bud and Rebuild will create all those object files; that's how they work. You could put the files in a global directory and use that directory as your library. Something like, /home/lars/tango/obj, and configure all your projects to use that path as obj output. I'm not doing that because I just thought of that idea, but I think it could work.

Someone once gave me this sh script to build a Tango library. I don't use it, but you could find it useful.

#!/bin/sh
rm obj/*.o libltango.a -v
export count=0; find tango -name "*.d" |while read a; do count=`expr $count + 1`; gdc -ltango -c -o obj/$count.o -O2 -finline-functions -frelease -fversion=Posix $a 2>/dev/null && echo -n "$count-$a ° "; done
ar q libltango.a obj/*.o

I guess you wouldn't need Bud or Rebuild if you use the resulting library.

-- 
Carlos Santander Bernal
August 17, 2007
* Lars Noschinski <lars-2006-1@usenet.noschinski.de> [07-08-17 19:28]:
>Bud does not build with Tango, so I tried rebuild. It works, but builds
>a lot of object files, probably one for each Tango class used. This is
>somehow annoying and I wonder, if there should not a precompiled binary?
>
>I installed Tango/GDC via the tango+gdc installer from the tango
>website in /usr/local.

Hm, the order of arguments to matters:

    % gdc -I /usr/local/include -fversion=Posix dzen-status.d -lgtango

works, but

    % gdc -I /usr/local/include -fversion=Posix -lgtango dzen-status.d

fails with undefined references:

    /tmp/ccWAFn0z.o: In function `_Dmain':
    dzen-status.d:(.text+0x54): undefined reference to `_D5tango3sys7Process7Process7__ClassZ'
    dzen-status.d:(.text+0x6f): undefined reference to `_D5tango3sys7Process7Process5_ctorMFAAaXC5tango3sys7Process7Process'
    dzen-status.d:(.text+0xdd): undefined reference to `_D5tango2io6Stdout6StdoutC5tango2io5Print12__T5PrintTaZ5Print'
    dzen-status.d:(.text+0x103): undefined reference to `_D5tango2io5Print12__T5PrintTaZ5Print8formatlnMFAaYC5tango2io5Print12__T5PrintTaZ5Print'
    /tmp/ccWAFn0z.o:(.data+0x34): undefined reference to `_D5tango2io6Stdout12__ModuleInfoZ'
    /tmp/ccWAFn0z.o:(.data+0x38): undefined reference to `_D5tango3sys7Process12__ModuleInfoZ'
    collect2: ld returned 1 exit status

This is actually documented in the gcc documentation, but did not occur
to me yesterday, so I failed to link against libgtango:

    It makes a difference where in the command you write this option;
    the linker searches and processes libraries and object files in the
    order they are specified.  Thus, `foo.o -lz bar.o' searches library
    `z' after file `foo.o' but before `bar.o'.  If `bar.o' refers to
    functions in `z', those functions may not be loaded.

August 17, 2007
Carlos Santander wrote:

> Lars Noschinski escribió:
>> * Carlos Santander <csantander619@gmail.com> [07-08-16 07:00]:
>>>
>>> I've had more luck getting Tango programs to compile with either Bud
>>> (as in the examples) or Rebuild.
>> 
>> Bud does not build with Tango, so I tried rebuild. It works, but builds a lot of object files, probably one for each Tango class used. This is somehow annoying and I wonder, if there should not a precompiled binary?
>> 
>> I installed Tango/GDC via the tango+gdc installer from the tango website in /usr/local.
> 
> Regarding Bud, first you would have to build it using GPhobos, and then switch to Tango.
> 
> Both Bud and Rebuild will create all those object files; that's how they work. You could put the files in a global directory and use that directory as your library. Something like, /home/lars/tango/obj, and configure all your projects to use that path as obj output. I'm not doing that because I just thought of that idea, but I think it could work.
> 
> Someone once gave me this sh script to build a Tango library. I don't use it, but you could find it useful.

You will now find build-tango.sh in lib/ that should work for you :)

-- 
Lars Ivar Igesund
blog at http://larsivi.net
DSource, #d.tango & #D: larsivi
Dancing the Tango