www.digitalmars.com         C & C++   DMDScript  

D.gnu - GDC bug? duplicates symbols when using mixin and interface

reply Daniel Kozak <kozzi11 gmail.com> writes:
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
Oct 24 2019
next sibling parent Daniel Kozak <kozzi11 gmail.com> writes:
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
Oct 24 2019
prev sibling parent reply Daniel Kozak <kozzi11 gmail.com> writes:
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
Oct 29 2019
parent reply Matthias Klumpp <mak debian.org> writes:
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
Nov 18 2019
parent BoraxMan <rotflol2 hotmail.com> writes:
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.
Dec 27 2019