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

Trouble installing/compiling on Ubuntu

Moderators: larsivi kris

Posted: 04/05/07 23:22:00

Hi there,

I've tried a variety of things, and I'm having difficulty getting anything beyond the supplied stdc.printf hello.d to compile under Tango. For instance, when I try to compile:

import  tango.io.Console;

void    main()
{
   Cout("Hello, World").newline;
}

with dmd tangoio.d, I get

gcc tangoio.o -o tangoio -m32 -lphobos -lpthread -lm 
tangoio.o:(.data+0x30): undefined reference to `_D5tango2io7Console12__ModuleInfoZ'
tangoio.o: In function `_Dmain':
tangoio.d:(.gnu.linkonce.t_Dmain+0x10): undefined reference to `_D5tango2io7Console4CoutC5tango2io7Console7Console6Output'
collect2: ld returned 1 exit status
--- errorlevel 1

or with bud (sudo bud tangoio.d -op)

/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../lib/libphobos.a(linux.o):(.data+0x4): multiple definition of `FD_SETSIZE'
/usr/local/include/tango/stdc/posix/sys/select.o:(.data+0x4): first defined here
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../lib/libphobos.a(linux.o):(.data+0xc): multiple definition of `RTLD_NOW'
/usr/local/include/tango/stdc/posix/dlfcn.o:(.data+0x4): first defined here
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../lib/libphobos.a(linux.o):(.data+0x10): multiple definition of `_SIGSET_NWORDS'
/usr/local/include/tango/stdc/posix/signal.o:(.data+0x40): first defined here
/usr/local/include/tango/io/Console.o:(.rodata+0x34): undefined reference to `_D6object6Object6toUtf8MFZAa'
/usr/local/include/tango/io/Console.o:(.rodata+0x90): undefined reference to `_D6object6Object6toUtf8MFZAa'
/usr/local/include/tango/io/Console.o:(.rodata+0x108): undefined reference to `_D6object6Object6toUtf8MFZAa'
/usr/local/include/tango/io/Buffer.o:(.rodata+0x100): undefined reference to `_D6object6Object6toUtf8MFZAa'
/usr/local/include/tango/io/Buffer.o: In function `_D5tango2io6Buffer6Buffer5errorMFAaZv':
/usr/local/include/tango/io/Buffer.d:(.gnu.linkonce.t_D5tango2io6Buffer6Buffer5errorMFAaZv+0xf): undefined reference to `_D5tango4core9Exception11IOException7__ClassZ'
/usr/local/include/tango/io/Buffer.d:(.gnu.linkonce.t_D5tango2io6Buffer6Buffer5errorMFAaZv+0x23): undefined reference to `_D5tango4core9Exception11IOException5_ctorMFAaZC5tango4core9Exception11IOException'
/usr/local/include/tango/io/DeviceConduit.o:(.rodata+0x74): undefined reference to `_D6object6Object6toUtf8MFZAa'
/usr/local/include/tango/io/DeviceConduit.o:(.rodata+0x110): undefined reference to `_D6object6Object6toUtf8MFZAa'
/usr/local/include/tango/io/Conduit.o:(.rodata+0x11c): undefined reference to `_D6object6Object6toUtf8MFZAa'
/usr/local/include/tango/io/Conduit.o: In function `_D5tango2io7Conduit7Conduit9exceptionFAaZv':
/usr/local/include/tango/io/Conduit.d:(.gnu.linkonce.t_D5tango2io7Conduit7Conduit9exceptionFAaZv+0x4): undefined reference to `_D5tango4core9Exception11IOException7__ClassZ'
/usr/local/include/tango/io/Conduit.d:(.gnu.linkonce.t_D5tango2io7Conduit7Conduit9exceptionFAaZv+0x18): undefined reference to `_D5tango4core9Exception11IOException5_ctorMFAaZC5tango4core9Exception11IOException'
collect2: ld returned 1 exit status

I get very similar errors with GDC. Here's my /etc/dmd.conf:

[Environment]
DFLAGS=-I/usr/local/include/ -version=Posix -version=Tango

I have tango's libphobos.a and libtango.a in /usr/local/lib, and in /usr/local/include, I have std/, tango/, and object.di

I'm probably missing something obvious, but I'm quite new with linux, so I'm not sure what.

Thanks for your help,

Reiner

Author Message

Posted: 04/06/07 09:15:39

Let's see. I assume you're aware that using bud means that you don't need the libtango.a library. Next, when on Linux, consider installing rebuild instead as it lately have been functioning better on that platform.

Your first command, where you use DMD directly, assumes that you have Tango (not just the runtime) as a library. I don't think dmd looks in /usr/local/lib for libraries, so you probably have to pass that path to DMD in dmd.conf. I'm guessing -L-L/usr/local/lib , but I'm not fully sure. Then you also need to specify libtango.a to DMD, either just put it directly in the command or in dmd.conf. Thus it may look like this

[Environment]
DFLAGS=-I/usr/local/include -L-L/usr/local/lib -version=Posix -version=Tango libtango.a

Please test and let me know if it works? I will try to update the install docs over the next few days.

As for GDC, I'm not totally sure what would be the exact solution, but there are a couple of installers on the download page that you may try. One of them should also include DSSS/Rebuild.

Posted: 04/06/07 23:31:14

Thanks for your help.

I had tried the installers on the download page before, and none of them ran -- corrupt tar file. After playing around with it today, I fixed the line count in the script (for GDC+tango+DSSS), and the tar file was properly extracted and it installed gdc and tango, but not DSSS. I actually think it put tango in the wrong place according to http://www.dsource.org/projects/tango/wiki/UnixInstallGdc. Never mind. I installed it manually based on the tar file in that installer and the guide I linked above, and rebuild+gdc now compiles my tangoio.d file. So that is working right now.

I tried your suggestion with DMD. It couldn't find libtango.a, so I tried

DFLAGS=-I/usr/local/include -L-L/usr/local/lib -version=Posix -version=Tango /usr/local/lib/libtango.a

Similar error to bud:

gcc tangoio.o -o tangoio /usr/local/lib/libtango.a -m32 -lphobos -lpthread -lm 
/usr/local/lib/libtango.a(tango.io.Console.o):(.rodata+0x34): undefined reference to `_D6object6Object6toUtf8MFZAa'
/usr/local/lib/libtango.a(tango.io.Console.o):(.rodata+0x90): undefined reference to `_D6object6Object6toUtf8MFZAa'
/usr/local/lib/libtango.a(tango.io.Console.o):(.rodata+0x104): undefined reference to `_D6object6Object6toUtf8MFZAa'
/usr/local/lib/libtango.a(tango.io.Conduit.o):(.rodata+0x11c): undefined reference to `_D6object6Object6toUtf8MFZAa'
/usr/local/lib/libtango.a(tango.io.Conduit.o): In function `_D5tango2io7Conduit7Conduit9exceptionFAaZv':
tango/io/Conduit.d:(.gnu.linkonce.t_D5tango2io7Conduit7Conduit9exceptionFAaZv+0x4): undefined reference to `_D5tango4core9Exception11IOException7__ClassZ'
tango/io/Conduit.d:(.gnu.linkonce.t_D5tango2io7Conduit7Conduit9exceptionFAaZv+0x18): undefined reference to `_D5tango4core9Exception11IOException5_ctorMFAaZC5tango4core9Exception11IOException'
/usr/local/lib/libtango.a(tango.io.Buffer.o):(.rodata+0x100): undefined reference to `_D6object6Object6toUtf8MFZAa'
/usr/local/lib/libtango.a(tango.io.Buffer.o): In function `_D5tango2io6Buffer6Buffer5errorMFAaZv':
tango/io/Buffer.d:(.gnu.linkonce.t_D5tango2io6Buffer6Buffer5errorMFAaZv+0xf): undefined reference to `_D5tango4core9Exception11IOException7__ClassZ'
tango/io/Buffer.d:(.gnu.linkonce.t_D5tango2io6Buffer6Buffer5errorMFAaZv+0x23): undefined reference to `_D5tango4core9Exception11IOException5_ctorMFAaZC5tango4core9Exception11IOException'
/usr/local/lib/libtango.a(tango.io.DeviceConduit.o):(.rodata+0x74): undefined reference to `_D6object6Object6toUtf8MFZAa'
/usr/local/lib/libtango.a(tango.io.DeviceConduit.o):(.rodata+0x110): undefined reference to `_D6object6Object6toUtf8MFZAa'
collect2: ld returned 1 exit status
--- errorlevel 1

And with DMD+Rebuild:

gcc ./tangoio.o ./tango.io.Console.o ./tango.sys.Common.o ./tango.sys.linux.linux.o ./tango.stdc.time.o ./tango.stdc.config.o ./tango.stdc.stddef.o ./tango.stdc.posix.dlfcn.o ./tango.stdc.posix.fcntl.o ./tango.stdc.stdint.o ./tango.stdc.posix.sys.types.o ./tango.stdc.posix.sys.stat.o ./tango.stdc.posix.time.o ./tango.stdc.posix.signal.o ./tango.stdc.signal.o ./tango.stdc.posix.poll.o ./tango.stdc.posix.pwd.o ./tango.stdc.posix.unistd.o ./tango.stdc.posix.inttypes.o ./tango.stdc.inttypes.o ./tango.stdc.posix.sys.select.o ./tango.stdc.posix.sys.time.o ./tango.sys.linux.epoll.o ./tango.stdc.errno.o ./tango.stdc.string.o ./tango.io.Buffer.o ./tango.io.model.IBuffer.o ./tango.io.model.IConduit.o ./tango.io.DeviceConduit.o ./tango.io.Conduit.o -o tangoio -m32 -lphobos -lpthread -lm 
./tango.io.Console.o:(.rodata+0x84): undefined reference to `_D6object6Object6toUtf8MFZAa'
./tango.io.Console.o:(.rodata+0xe4): undefined reference to `_D6object6Object6toUtf8MFZAa'
./tango.io.Console.o:(.rodata+0x184): undefined reference to `_D6object6Object6toUtf8MFZAa'
./tango.io.Console.o:(.eh_frame+0x11): undefined reference to `__gdc_personality_v0'
./tango.sys.Common.o:(.eh_frame+0x11): undefined reference to `__gdc_personality_v0'
./tango.stdc.posix.sys.select.o:(.eh_frame+0x11): undefined reference to `__gdc_personality_v0'
./tango.stdc.errno.o:(.eh_frame+0x11): undefined reference to `__gdc_personality_v0'
./tango.io.Buffer.o: In function `_D5tango2io6Buffer6Buffer5errorMFAaZv':
Buffer.d:(.text+0x1f6): undefined reference to `_D5tango4core9Exception11IOException7__ClassZ'
Buffer.d:(.text+0x213): undefined reference to `_D5tango4core9Exception11IOException5_ctorMFAaZC5tango4core9Exception11IOException'
Buffer.d:(.text+0x21b): undefined reference to `_d_throw'
./tango.io.Buffer.o:(.rodata+0x124): undefined reference to `_D6object6Object6toUtf8MFZAa'
./tango.io.Buffer.o:(.eh_frame+0x11): undefined reference to `__gdc_personality_v0'
./tango.io.DeviceConduit.o:(.rodata+0x84): undefined reference to `_D6object6Object6toUtf8MFZAa'
./tango.io.DeviceConduit.o:(.rodata+0x124): undefined reference to `_D6object6Object6toUtf8MFZAa'
./tango.io.DeviceConduit.o:(.eh_frame+0x11): undefined reference to `__gdc_personality_v0'
./tango.io.Conduit.o: In function `_D5tango2io7Conduit7Conduit9exceptionFAaZv':
Conduit.d:(.text+0x555): undefined reference to `_D5tango4core9Exception11IOException7__ClassZ'
Conduit.d:(.text+0x570): undefined reference to `_D5tango4core9Exception11IOException5_ctorMFAaZC5tango4core9Exception11IOException'
Conduit.d:(.text+0x578): undefined reference to `_d_throw'
./tango.io.Conduit.o:(.rodata+0x164): undefined reference to `_D6object6Object6toUtf8MFZAa'
./tango.io.Conduit.o:(.eh_frame+0x11): undefined reference to `__gdc_personality_v0'
collect2: ld returned 1 exit status
--- errorlevel 1

Nevertheless, it now works on GDC, so thanks for your help. I don't know what's wrong with DMD, but I'm not so concerned now.

Cheers,

Reiner