dmd -> ldmd2: /usr/bin/ld.gold: error: <source>.o: multiple definition of 'bool ldc.attributes...

kdevel kdevel at vogtner.de
Sun Mar 7 11:34:08 UTC 2021


On Sunday, 7 March 2021 at 01:29:50 UTC, Preetpal wrote:
[...]
> Can you post more information? Like the full error that you are 
> seeing,

[link cmd]
/usr/bin/ld.gold: error: pointless.o: multiple definition of 
'_D3ldc10attributes10assumeUsedySQBeQBd11_assumeUsed'
/usr/bin/ld.gold: localscop.o: previous definition here
/usr/bin/ld.gold: error: pointless.o: multiple definition of 
'_D3ldc10attributes11optStrategy11__xopEqualsFKxSQBuQBtQBkKxQmZb'
/usr/bin/ld.gold: localscop.o: previous definition here
/usr/bin/ld.gold: error: pointless.o: multiple definition of 
'_D3ldc10attributes11optStrategy9__xtoHashFNbNeKxSQBvQBuQBlZm'
/usr/bin/ld.gold: localscop.o: previous definition here
/usr/bin/ld.gold: error: pointless.o: multiple definition of 
'_D3ldc10attributes12__ModuleInfoZ'
/usr/bin/ld.gold: localscop.o: previous definition here
/usr/bin/ld.gold: error: pointless.o: multiple definition of 
'_D3ldc10attributes14dynamicCompileySQBiQBh15_dynamicCompile'
/usr/bin/ld.gold: localscop.o: previous definition here
/usr/bin/ld.gold: error: pointless.o: multiple definition of 
'_D3ldc10attributes16llvmFastMathFlag11__xopEqualsFKxSQBzQByQBpKxQmZb'
[...]

> the command you are forced to use to allow everything to 
> compile,

./dmd -i -I=tillyscop:tillyscop/msgpack-d/src -O -g 
-of=localscop.o -c tillyscop/scop.d tillyscop/scopserializer.d

and

./dmd -i -of=pointless.o -g -c pointless/package.d

"dmd" is a symlink to /opt/ldc2/bin/ldmd2

> the platform that you are on (Mac, BSD, Linux, etc.).

x86_64, Linux, OpenSUSE 42.2.

$ rpm -qi binutils
Name        : binutils
Version     : 2.29.1
Release     : 9.6.1
Architecture: x86_64

To check if the linker makes problems I have replaced ld.gold 
with the ld-new from hand-compiled binutils 2.36.1. Now the error 
messages look a bit different,
a bit more verbose:

/usr/bin/ld.gold: 
pointless.o:(.rodata._D3ldc10attributes10assumeUsedySQBeQBd11_assumeUsed+0x0): multiple definition of $
_D3ldc10attributes10assumeUsedySQBeQBd11_assumeUsed'; 
/usr/bin/ld.gold: DWARF error: could not find variable 
specificatio
n at offset a0b
/usr/bin/ld.gold: DWARF error: could not find variable 
specification at offset 23de
localscop.o:(.rodata._D3ldc10attributes10assumeUsedySQBeQBd11_assumeUsed+0x0): first defined here
/usr/bin/ld.gold: pointless.o: in function 
`_D3ldc10attributes11optStrategy11__xopEqualsFKxSQBuQBtQBkKxQmZb':
/opt/ldc2-1.25.1-linux-x86_64/bin/../import/ldc/attributes.d:(.text._D3ldc10attributes11optStrategy11__xopEqualsFKxSQBuQB
tQBkKxQmZb+0x0): multiple definition of 
`_D3ldc10attributes11optStrategy11__xopEqualsFKxSQBuQBtQBkKxQmZb'; localscop.o:/o
pt/ldc2-1.25.1-linux-x86_64/bin/../import/ldc/attributes.d:(.text._D3ldc10attributes11optStrategy11__xopEqualsFKxSQBuQBtQ
BkKxQmZb+0x0): first defined here
[...]




More information about the Digitalmars-d-learn mailing list