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

GDC + Tango on x86_64: undefined references

Moderators: larsivi kris

Posted: 03/28/08 18:18:45

How do I use tango + gdc on x86_64 linux? (Using gdc 4.1 20080114 & tango 0.99.5 or r3401.)

OK, I've successfully compiled (at least I thought) libgphobos.a and libgtango.a using the lib/ scripts and installed. I can compile, but at link time get undefined references (using either dsss with the gdc-posix-tango profile or gdmd directly & linking libgtango.a).

Testing building on a ~4000 line project, I get the following undefined references (this is a cleaned up list of all link errors):

undefined reference to `_D5tango4core6Thread6Thread4joinMFbZv'
undefined reference to `_D5tango4core6Thread6Thread5sleepFdZv'
undefined reference to `_D5tango4core6Thread11ThreadGroup7__ClassZ'
undefined reference to `_D5tango4core6Thread11ThreadGroup6createMFPFZvZC5tango4core6Thread6Thread'
undefined reference to `_D5tango4core6Thread11ThreadGroup7opApplyMFDFKC5tango4core6Thread6ThreadZiZi'
undefined reference to `_D5tango4core6Thread12__ModuleInfoZ'
undefined reference to `_D5tango4core9Exception11IOException7__ClassZ'
undefined reference to `_D5tango4core9Exception11IOException5_ctorMFAaZC5tango4core9Exception11IOException'
undefined reference to `_D5tango4core9Exception13TextException7__ClassZ'
undefined reference to `_D5tango4core9Exception13TextException5_ctorMFAaZC5tango4core9Exception13TextException'
undefined reference to `_D5tango4core9Exception15ThreadException7__ClassZ'
undefined reference to `_D5tango4core9Exception16UnicodeException7__ClassZ'
undefined reference to `_D5tango4core9Exception16UnicodeException5_ctorMFAamZC5tango4core9Exception16UnicodeException'
undefined reference to `_D5tango4core9Exception17PlatformException7__ClassZ'
undefined reference to `_D5tango4core9Exception17PlatformException5_ctorMFAaZC5tango4core9Exception17PlatformException'
undefined reference to `_D5tango4core9Exception20ArrayBoundsException7__ClassZ'
undefined reference to `_D5tango4core9Exception22NoSuchElementException7__ClassZ'
undefined reference to `_D5tango4core9Exception22NoSuchElementException5_ctorMFAaZC5tango4core9Exception22NoSuchElementException'
undefined reference to `_D5tango4core9Exception23IllegalElementException7__ClassZ'
undefined reference to `_D5tango4core9Exception23IllegalElementException5_ctorMFAaZC5tango4core9Exception23IllegalElementException'
undefined reference to `_D5tango4core9Exception24IllegalArgumentException7__ClassZ'
undefined reference to `_D5tango4core9Exception24IllegalArgumentException5_ctorMFAaZC5tango4core9Exception24IllegalArgumentException'
undefined reference to `_D5tango4core9Exception26CorruptedIteratorException7__ClassZ'
undefined reference to `_D5tango4core9Exception26CorruptedIteratorException5_ctorMFAaZC5tango4core9Exception26CorruptedIteratorException'
undefined reference to `_D6object9Exception5_ctorMFAaC9ExceptionZC9Exception'
undefined reference to `onUnicodeError'

Hence it looks like just Exception.d is missing. I checked the build scripts to see that ar links Exception.o into both libraries that it should. So I'm now unsure of what to try next... any ideas? Is this a tango bug or something else? Thanks in advance for any help.

Author Message

Posted: 03/28/08 18:53:24

Try

ar -tf libgphobos.a | grep Exception.o

If you get a result, then it is weird - if it's not there, you have to look for Exception when running build-gdc.sh, although I would expect the full process to fail.

Posted: 03/28/08 19:30:17

Yep it's there. Konqueror also tells me it's 35.2KB (larger than most other objects) so it's not empty either.

Posted: 03/29/08 09:17:52

Err.. actually it's a few thread objects as well, so not just Exception.o missing; could potentially be the tango.core lib.

I checked with readelf -h and it looks like the common part is 64-bit.

But I tried linking the parts directly, and found the compiler/ lib is missing! I'll take a look later.

Posted: 04/07/08 16:11:42

Not sure that the lib I thought was missing was meant to be there anyway... ??

I've tried with the above-mentioned gdc and tango 0.99.5 and latest svn, and the binary bundle from http://www.dsource.org/projects/tango/wiki/GdcDownloads (inc gdc and dsss, using gdc stable) and got (at least roughly) the same result each time.

I also tried the i686 version of the above binary dl and got a rather different result:

Creating imports for escSeqs

chrs.d => chrs
+ /usr/local/gdc/bin/rebuild -Idsss_imports/ -I. -S./ -I/usr/local/gdc/include/d -S/usr/local/gdc/lib/  -I/usr/local/gdc/include/d -S/usr/local/gdc/lib -I/home/cyborg/d/include/d -S/home/cyborg/d/lib  -oqdsss_objs/G  chrs.d -ofchrs
/tmp/ccoOEEOj.s: Assembler messages:
/tmp/ccoOEEOj.s:23: Error: suffix or operands invalid for `push'
/tmp/ccoOEEOj.s:25: Error: suffix or operands invalid for `push'
/tmp/ccoOEEOj.s:29: Error: suffix or operands invalid for `push'
/tmp/ccoOEEOj.s:98: Error: suffix or operands invalid for `pop'
/tmp/ccoOEEOj.s:99: Error: suffix or operands invalid for `pop'
/tmp/ccoOEEOj.s:131: Error: suffix or operands invalid for `push'
/tmp/ccoOEEOj.s:135: Error: suffix or operands invalid for `push'
/tmp/ccoOEEOj.s:156: Error: suffix or operands invalid for `jmp'
/tmp/ccoOEEOj.s:341: Error: suffix or operands invalid for `pop'
/tmp/ccoOEEOj.s:342: Error: suffix or operands invalid for `pop'
/tmp/ccoOEEOj.s:356: Error: suffix or operands invalid for `push'
/tmp/ccoOEEOj.s:360: Error: suffix or operands invalid for `push'
/tmp/ccoOEEOj.s:362: Error: suffix or operands invalid for `push'
/tmp/ccoOEEOj.s:364: Error: suffix or operands invalid for `push'
/tmp/ccoOEEOj.s:414: Error: suffix or operands invalid for `pop'
/tmp/ccoOEEOj.s:415: Error: suffix or operands invalid for `pop'
/tmp/ccoOEEOj.s:416: Error: suffix or operands invalid for `pop'
/tmp/ccoOEEOj.s:417: Error: suffix or operands invalid for `pop'
/tmp/ccoOEEOj.s:517: Error: suffix or operands invalid for `push'
/tmp/ccoOEEOj.s:524: Error: suffix or operands invalid for `pop'
Command /usr/local/gdc/bin/rebuild returned with code 256, aborting.
Error: Command failed, aborting.

which is hardly an issue for me, but unfortunately means I can't check if it would have the same problem as above.

Any bright ideas?

At least I can still use dmd *shrugs*

Posted: 04/07/08 17:01:28

The sublibs in compiler are cleaned by the normal build process (their objects are included in the runtime library that you use). What is a possible problem is order of linking - a library dependency must come after on the link command line, even if this means that a library must be passed several times.

As for the new messages; that looks like some architecture difference, although it sounds somewhat strange since x86 should work on x86-64

Posted: 04/12/08 16:44:00

The i686 gdc thing is weird; dmd works fine. Not that I want to run 32-bit gdc anyway...

I don't think the undefined refs problem is to do with linking order because I get the same thing with this command (about things which should be in libgphobos (checked)).

gdmd chrs.d -version=Posix -I/usr/local/gdc/include/d -L-L/usr/local/gdc/lib -L-lgphobos -L-lDG-tango-io -L-lgphobos -L-lDG-tango-text -L-lgphobos