www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - [Tango] Linker error when using tango.io.file

reply Timo Gransch <timo.gransch gmx.de> writes:
Hello!

After a couple of months, I wanted to write a small programm using DMD 1.028
and Tango 0.99.6 (Jeff) on Linux. Both were installed using the install
script from the DWT Page (
http://www.dsource.org/projects/dwt/wiki/SetupLinux ). I use CodeBlocks
8,02 as my IDE.

Unfortunately my code fails to compile as soon as I try to use
tango.io.File. 

This sample code compiles fine: 

module test;

import tango.io.Console;
import tango.io.File;

int main()
{
    File f=null;

    Cout ("Test of Tango file functions").newline;

    //f=File("text.txt");

    return 0;
}

But as soon as I uncomment the line "f=File("text.txt");", I get the
following message when linking: 

Compiling: test.d
Linking console executable: bin/Debug/test-tango
/usr/lib/gcc/i486-linux-gnu/4.2.4/../../../../lib/libtango-user-dmd.a(tango.time.Time.o)
(.data._D48TypeInfo_E5tango4time4Time8TimeSpan11__anonymous6__initZ+0x8):
undefined reference to `_D10TypeInfo_l6__initZ'
/usr/lib/gcc/i486-linux-gnu/4.2.4/../../../../lib/libtango-user-dmd.a(tango.time.Time.o)
(.data._D44TypeInfo_E5tango4time4Time4Time11__anonymous6__initZ+0x8):
undefined reference to `_D10TypeInfo_l6__initZ'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

I'm linking with libpthread.a, libm.a, libtango-base-dmd.a and
libtango-user-dmd.a. Am I missing another library?

Best regards and thanks in advance,
Timo
Jul 19 2008
next sibling parent Lars Ivar Igesund <larsivar igesund.net> writes:
Timo Gransch wrote:

 Hello!
 
 After a couple of months, I wanted to write a small programm using DMD
 1.028 and Tango 0.99.6 (Jeff) on Linux. Both were installed using the
 install script from the DWT Page (
 http://www.dsource.org/projects/dwt/wiki/SetupLinux ). I use CodeBlocks
 8,02 as my IDE.
 
 Unfortunately my code fails to compile as soon as I try to use
 tango.io.File.
 
 This sample code compiles fine:
 
 module test;
 
 import tango.io.Console;
 import tango.io.File;
 
 int main()
 {
     File f=null;
 
     Cout ("Test of Tango file functions").newline;
 
     //f=File("text.txt");
 
     return 0;
 }
 
 But as soon as I uncomment the line "f=File("text.txt");", I get the
 following message when linking:
 
 Compiling: test.d
 Linking console executable: bin/Debug/test-tango
 /usr/lib/gcc/i486-linux-gnu/4.2.4/../../../../lib/libtango-user-dmd.a(tango.time.Time.o)
 (.data._D48TypeInfo_E5tango4time4Time8TimeSpan11__anonymous6__initZ+0x8):
 undefined reference to `_D10TypeInfo_l6__initZ'
 /usr/lib/gcc/i486-linux-gnu/4.2.4/../../../../lib/libtango-user-dmd.a(tango.time.Time.o)
 (.data._D44TypeInfo_E5tango4time4Time4Time11__anonymous6__initZ+0x8):
 undefined reference to `_D10TypeInfo_l6__initZ'
 collect2: ld returned 1 exit status
 Process terminated with status 1 (0 minutes, 0 seconds)
 0 errors, 0 warnings
 
 I'm linking with libpthread.a, libm.a, libtango-base-dmd.a and
 libtango-user-dmd.a. Am I missing another library?
 
 Best regards and thanks in advance,
 Timo
Without me having seen that exact error, it sounds like one of the issues with anonymous stuff in that particular range of DMD compilers. If possible, you should upgrade to DMD 1.033 (or alternatively downgrade to DMD 1.027). -- Lars Ivar Igesund blog at http://larsivi.net DSource, #d.tango & #D: larsivi Dancing the Tango
Jul 19 2008
prev sibling parent reply Frank Benoit <keinfarbton googlemail.com> writes:
Timo Gransch schrieb:
 Hello!
 
 After a couple of months, I wanted to write a small programm using DMD 1.028
 and Tango 0.99.6 (Jeff) on Linux. Both were installed using the install
 script from the DWT Page (
 http://www.dsource.org/projects/dwt/wiki/SetupLinux ). I use CodeBlocks
 8,02 as my IDE.
 
 Unfortunately my code fails to compile as soon as I try to use
 tango.io.File. 
 
 This sample code compiles fine: 
 
 module test;
 
 import tango.io.Console;
 import tango.io.File;
 
 int main()
 {
     File f=null;
 
     Cout ("Test of Tango file functions").newline;
 
     //f=File("text.txt");
 
     return 0;
 }
 
 But as soon as I uncomment the line "f=File("text.txt");", I get the
 following message when linking: 
 
 Compiling: test.d
 Linking console executable: bin/Debug/test-tango
 /usr/lib/gcc/i486-linux-gnu/4.2.4/../../../../lib/libtango-user-dmd.a(tango.time.Time.o)
 (.data._D48TypeInfo_E5tango4time4Time8TimeSpan11__anonymous6__initZ+0x8):
 undefined reference to `_D10TypeInfo_l6__initZ'
 /usr/lib/gcc/i486-linux-gnu/4.2.4/../../../../lib/libtango-user-dmd.a(tango.time.Time.o)
 (.data._D44TypeInfo_E5tango4time4Time4Time11__anonymous6__initZ+0x8):
 undefined reference to `_D10TypeInfo_l6__initZ'
 collect2: ld returned 1 exit status
 Process terminated with status 1 (0 minutes, 0 seconds)
 0 errors, 0 warnings
 
 I'm linking with libpthread.a, libm.a, libtango-base-dmd.a and
 libtango-user-dmd.a. Am I missing another library?
 
 Best regards and thanks in advance,
 Timo
The script installs a copy of tango/dsss and other stuff into the installation directory. There is also a shell script called dsss.sh which serves as starter for dsss, ensuring it uses the correct paths. Your messages now looks like you did not use that shell script and it is now using another version of libtango-user-dmd.a as the one from the tango directory.
Jul 19 2008
parent Timo Gransch <timo.gransch gmx.de> writes:
Frank Benoit wrote:

 Your messages now looks like you did not use that shell script and it is
 now using another version of libtango-user-dmd.a as the one from the
 tango directory.
Thanks, Frank and Lars. In the meantime I have installed DMD 1.033 (as Lars suggested) compiled Tango from source. It works now. Best regards, Timo
Jul 20 2008