On 12/29/09 2:41 PM, Steven Schveighoffer wrote:
On Tue, 29 Dec 2009 16:34:20 -0500, grauzone <[email protected]> wrote:
revcompgeek wrote:
So I tried building Tango trunk a while ago, and it actually built
surprisingly well, with only one small error I was able to fix. So I
installed the tango library and proceeded to test if tango was really
working. So in hello.d:
import tango.io.Stdout;
void main(){ Stdout("Hello {}!","World").newline; }
I don't know why, but I had to manually add object.d to the command
line. To simplify, I put an object file of object.d into the current
directory.
tests% gdc -o hello hello.d object.o -lgtango -lgphobos
ld: duplicate symbol __D6object9Interface6__initZ in
/usr/local/lib/libgphobos.a(object.o) and object.o
collect2: ld returned 1 exit status
I'm not sure if this problem is an issue with gdc or a problem with
Tango. Any ideas on how to fix this?
You're linking with both Phobos and Tango. You can't do that, because
both come with their own (incompatible) runtime. Removing the
"-lgphobos" should work.
I think you need -lgphobos. Last time gdc was updated, the compiler
called the runtime gphobos, even though it was just the runtime :) Even
with dmd, tango needed to call the runtime libphobos to get it to link
because the name was hard-coded in the compiler. Subsequent versions of
dmd allowed changing the runtime library name. I don't know if gdc was
updated to do the same.
I think the problem is adding object.d to the command line, you should
not have to do that. The user is probably missing object.di. I'm not
sure how well the latest tango works with gdc. It's probably better to
ask on the tango forums (http://www.dsource.org/projects/tango/forums).
-Steve
If I don't add object.d to the command line, I get a ton more missing
symbols. I had also originally tried replacing libgphobos.a with
libgtango.a, but that didn't work either. I will try posting to the
forums, thanks.