Thread overview
GDC bug? duplicates symbols when using mixin and interface
Oct 24, 2019
Daniel Kozak
Oct 24, 2019
Daniel Kozak
Oct 29, 2019
Daniel Kozak
Nov 19, 2019
Matthias Klumpp
Dec 28, 2019
BoraxMan
October 24, 2019
I have been trying to compile gtkd with gdc but without success. I always end up with some duplicates symbols when gdc try to link final binary [https://github.com/gtkd-developers/GtkD/issues/282]

I have tried it with ldc and dmd too, and both are working fine.
So I guess there is some symbolgen issue with gdc. To make it (hopefuly) easier to
investigate I have try to reduce it as much as I can by hand (I am unable to use dusmite or how it is called).

So to reproduce this issue one need to have two files for eg. (b.d and c.d) see below

// b.d ==========================================
class B : I
{
	protected override void getStruct(){}
	mixin A!();
	
}

mixin template A()
{
	public void* getS()
	{
		return null;
	}
}

public interface I
{
	public void* getS();
	protected void getStruct();
}

void main() {}

// EOF ==========================================

// c.d ==========================================

private import b;

class C : B
{
	protected override void getStruct() {}
}

// EOF ==========================================


$ gdc -c -o b.o b.d
$ gdc -c -o c.o c.d
$ gdc -o test.o b.o c.o

ld: c.o: in function `_DT16_D1b1B8__mixin24getSMFZPv':
c.d:(.text+0x27): multiple definition of `_DT16_D1b1B8__mixin24getSMFZPv'; b.o:b.d:(.text+0x38): first defined here





October 24, 2019
On Thursday, 24 October 2019 at 11:05:21 UTC, Daniel Kozak wrote:
> 
>
> ld: c.o: in function `_DT16_D1b1B8__mixin24getSMFZPv':
> c.d:(.text+0x27): multiple definition of `_DT16_D1b1B8__mixin24getSMFZPv'; b.o:b.d:(.text+0x38): first defined here

BTW. DMD does not includes those _DT16_D1b1B8__mixin24getSMFZPv symbols (ddemangle even could not decode them) in obj files and ldc does include tham but with small differecies in name and have defined them as W (weak reference) not T(text/code) as gdc does
October 29, 2019
On Thursday, 24 October 2019 at 11:05:21 UTC, Daniel Kozak wrote:
> 
> ld: c.o: in function `_DT16_D1b1B8__mixin24getSMFZPv':
> c.d:(.text+0x27): multiple definition of `_DT16_D1b1B8__mixin24getSMFZPv'; b.o:b.d:(.text+0x38): first defined here

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92216
November 19, 2019
On Tuesday, 29 October 2019 at 13:23:33 UTC, Daniel Kozak wrote:
> On Thursday, 24 October 2019 at 11:05:21 UTC, Daniel Kozak wrote:
>> 
>> ld: c.o: in function `_DT16_D1b1B8__mixin24getSMFZPv':
>> c.d:(.text+0x27): multiple definition of `_DT16_D1b1B8__mixin24getSMFZPv'; b.o:b.d:(.text+0x38): first defined here
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92216

Thank you for reporting this!
This error is also a major pain for us at Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=944380
December 28, 2019
On Tuesday, 19 November 2019 at 00:56:33 UTC, Matthias Klumpp wrote:
> On Tuesday, 29 October 2019 at 13:23:33 UTC, Daniel Kozak wrote:
>> On Thursday, 24 October 2019 at 11:05:21 UTC, Daniel Kozak wrote:
>>> 
>>> ld: c.o: in function `_DT16_D1b1B8__mixin24getSMFZPv':
>>> c.d:(.text+0x27): multiple definition of `_DT16_D1b1B8__mixin24getSMFZPv'; b.o:b.d:(.text+0x38): first defined here
>>
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92216
>
> Thank you for reporting this!
> This error is also a major pain for us at Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=944380


D IS is a great programming language, but I'm finding the implementation lacking, and having a good implementation of it, which integrates nicely with the OS is critical to it working as a systems language.  I've found a few problems with GDC (at least on Fedora) that make it almost unworkable as a D implementation.