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

Build problems after installing Tango

Moderators: kris

Posted: 07/16/07 01:24:42

Hi All,

I'm an enthusiastic new D programmer and I've been trying to get Tango installed and building, and running into an undefined reference that I just can't seem to resolve. I've made sure that I've replaced libphobos.a with the version distributed with Tango, as well as of course moving the Tango 'import' directory into place, configuring my '/etc/dmd.conf' file to point to the 'import' directory and replacing the dmd compiler (and other bin tools) with those supplied with Tango. However, as seen below, I continue to get 'Object' as an undefined reference.

Any help would be greatly appreciated...

-TD

gcc t3.o player.o badguy.o goodguy.o -o t3 -m32 -Xlinker -L/usr/home/rbb/dmd/lib -ltango -lphobos -lpthread -lm player.o:(.rodata+0x48): undefined reference to `_D6object6Object6toUtf8MFZAa' badguy.o:(.rodata+0x4c): undefined reference to `_D6object6Object6toUtf8MFZAa' goodguy.o:(.rodata+0x4c): undefined reference to `_D6object6Object6toUtf8MFZAa' /usr/home/rbb/dmd/lib/libtango.a(tango.io.Console.o):(.rodata+0x34): undefined reference to `_D6object6Object6toUtf8MFZAa' /usr/home/rbb/dmd/lib/libtango.a(tango.io.Console.o):(.rodata+0x94): undefined reference to `_D6object6Object6toUtf8MFZAa' /usr/home/rbb/dmd/lib/libtango.a(tango.io.Buffer.o):(.rodata+0xe4): more undefined references to `_D6object6Object6toUtf8MFZAa' follow /usr/home/rbb/dmd/lib/libtango.a(tango.io.Buffer.o): In function `_D5tango2io6Buffer6Buffer5errorMFAaZv': tango/io/Buffer.d:(.gnu.linkonce.t_D5tango2io6Buffer6Buffer5errorMFAaZv+0xa): undefined reference to `_D5tango4core9Exception11IOException7ClassZ' tango/io/Buffer.d:(.gnu.linkonce.t_D5tango2io6Buffer6Buffer5errorMFAaZv+0x18): undefined reference to `_D5tango4core9Exception11IOException5_ctorMFAaZC5tango4core9Exception11IOException' /usr/home/rbb/dmd/lib/libtango.a(tango.io.Conduit.o): In function `_D5tango2io7Conduit7Conduit9exceptionMFAaZv': tango/io/Conduit.d:(.gnu.linkonce.t_D5tango2io7Conduit7Conduit9exceptionMFAaZv+0xa): undefined reference to `_D5tango4core9Exception11IOException7ClassZ' tango/io/Conduit.d:(.gnu.linkonce.t_D5tango2io7Conduit7Conduit9exceptionMFAaZv+0x18): undefined reference to `_D5tango4core9Exception11IOException5_ctorMFAaZC5tango4core9Exception11IOException' collect2: ld returned 1 exit status --- errorlevel 1

Author Message

Posted: 07/17/07 00:29:05

This message

`_D6object6Object6toUtf8MFZAa' /usr/home/rbb/dmd/lib/libtango.a(tango.io.Console.o):(.rodata+0x94): undefined reference to `_D6object6Object6toUtf8MFZAa'

Suggests that you might not have your object.di in the right place. Your import directory should look like this:

/std
/tango
object.di

Posted: 07/17/07 02:30:48

Hi Sean,

The configuration you're saying is exactly what I have. In fact, here's a listing of both my dmd.conf file as well as the contents of my directory (see below). Also, I think a missing .di file would be more of a compile time error, and mine is a link time error I think.

Finally, I do remember maybe reading something about Tango deprecating 'Object' (maybe I mis-read?). Anyhow, I thought this might have some bearing(?)

Thanks again...any follow-up would be great - I'm anxious to rock and roll! :)

-TD

rbb@Megatron:~/dmd/import$ cat /etc/dmd.conf

[Environment]

;DFLAGS=-I%@P%/../src/phobos -L-L%@P%/../lib DFLAGS=-I/usr/home/rbb/dmd/import -version=Posix -L-L/usr/home/rbb/dmd/lib -L-ltango rbb@Megatron:~/dmd/import$ rbb@Megatron:~/dmd/import$ rbb@Megatron:~/dmd/import$ rbb@Megatron:~/dmd/import$ ll total 20 drwxr-xr-x 4 rbb rbb 4096 2007-07-15 16:32 . drwxr-xr-x 9 rbb rbb 4096 2007-07-15 16:32 .. -rw-r--r-- 1 rbb rbb 3661 2007-07-15 16:32 object.di drwxr-xr-x 3 rbb rbb 4096 2007-07-15 16:32 std drwxr-xr-x 10 rbb rbb 4096 2007-07-15 16:32 tango rbb@Megatron:~/dmd/import$

Posted: 07/20/07 19:12:16

It seems that the problem I'm having was originally reported by Reiner in another message area on 4/05/07 (with no resolution). Is D/Tango not ready for prime time?

Posted: 07/20/07 20:01:48

In a final effort to resolve this problem I re-downloaded the tar file containing both tango and dmd from this site, making sure to copy the newly downloaded dmd.conf file into palce . And yet still, with a DMD and Tango that have been packaged together, I'm still getting this build error. I guess the next stop is subversion... :(

Posted: 07/20/07 21:21:43

Well, I tried a clean re-install from the 'Xammy' release, which had the same problem. Then, I did a subversion extract follwoing the instructions on the download page and, when compiling all the .d modules, received a ton of other error messages.

Why won't Tango dance for me?

Posted: 07/20/07 23:55:35 -- Modified: 07/20/07 23:57:46 by
sean

Oops. Then my guess is that Tango's libphobos.a isn't in the right place. That the linker can't find Object.toUtf8() suggests to me that it's likely attempting to link DMD's libphobos.a instead. I'm not sure if it helps, but on Linux from within the SVN tree I run "lib/build-dmd.sh" then change to the tango root (ie. just above /trunk) and run this script:

#!/bin/sh

dest="/usr/include/d"

#rm -fr   $dest
mkdir -p $dest
mkdir -p $dest/std
mkdir -p $dest/tango

cp -fr trunk/object.di $dest/.
cp -fr trunk/std      $dest/.
cp -fr trunk/tango    $dest/.

find $dest -name ".svn" -type d | xargs rm -fr
find $dest -name "*"    -type d | xargs chmod a+w

find $dest -name "*.d"  | xargs chmod a+r
find $dest -name "*.di" | xargs chmod a+r

cp -fr trunk/lib/libphobos.a /usr/lib/.

I'm sure it could be improved but it does the trick. And for what it's worth, I use Rebuild on Linux so I don't need to bother with a libtango.a. Otherwise, a few extra steps would be involved in the process. As should be evident from the script, it publishes the import files to /usr/include/d, which may or may not be where you want them.

Oh, I have no idea why I set all those files writable once published. I think it may have had something to do with Bud back when I used that instead (Bud writes object files into the same directory as the import file by default). You should be able to remove that line without any problems.

Posted: 07/21/07 00:16:25

Oh, I should mention that lib/install-dmd.sh should take care of the installation process for you as well. I just use my script because it's been around for far longer than install-dmd.sh and I've gotten used to the process.

Posted: 07/21/07 02:16:29

Hi Sean,

Thanks for the great suggestions - I'm betting this leads me to the promised land.

What I've been doing to rebuild Tango is:

find . -name "*.d" -exec dmd -c {} \; ar -r $LIB/libtango.a *.o rm -f *.o

(I move the 'win32' directory out of the way first). It's a bit of a shotgun approach, but only takes seconds.

I bet I have it building now in no time.

Thanks!