Thread overview |
---|
March 06, 2021 dmd -> ldmd2: /usr/bin/ld.gold: error: <source>.o: multiple definition of 'bool ldc.attributes... | ||||
---|---|---|---|---|
| ||||
After replacing dmd with ldmd2 (LDC 1.25.1) I get tons of link errors all of the form mentioned in the subject. Any idea what can be done about it? (With a handcrafted single compile/link statement using ldc2 everything compiles but ideally I want to reuse my Makefile). |
March 07, 2021 Re: dmd -> ldmd2: /usr/bin/ld.gold: error: <source>.o: multiple definition of 'bool ldc.attributes... | ||||
---|---|---|---|---|
| ||||
Posted in reply to kdevel | On Saturday, 6 March 2021 at 22:14:26 UTC, kdevel wrote:
> After replacing dmd with ldmd2 (LDC 1.25.1) I get tons of link errors all of
> the form mentioned in the subject. Any idea what can be done about it?
>
> (With a handcrafted single compile/link statement using ldc2 everything compiles
> but ideally I want to reuse my Makefile).
Can you post more information? Like the full error that you are seeing, the command you are forced to use to allow everything to compile, the platform that you are on (Mac, BSD, Linux, etc.).
|
March 07, 2021 Re: dmd -> ldmd2: /usr/bin/ld.gold: error: <source>.o: multiple definition of 'bool ldc.attributes... | ||||
---|---|---|---|---|
| ||||
Posted in reply to Preetpal | 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 [...] |
March 07, 2021 Re: dmd -> ldmd2: /usr/bin/ld.gold: error: <source>.o: multiple definition of 'bool ldc.attributes... | ||||
---|---|---|---|---|
| ||||
Posted in reply to kdevel | On Saturday, 6 March 2021 at 22:14:26 UTC, kdevel wrote: > After replacing dmd with ldmd2 (LDC 1.25.1) I get tons of link errors all of > the form mentioned in the subject. Any idea what can be done about it? > > (With a handcrafted single compile/link statement using ldc2 everything compiles > but ideally I want to reuse my Makefile). I think i had a similar error, can you try adding >version(LDC) pragma(LDC_no_moduleinfo) to the affected modules? At the line just after the module declaration, particularly in all package.d files and the file that contains the main function. However, your error seems to be with the files inside LDC... I'm not sure if this will solve it. |
March 07, 2021 Re: dmd -> ldmd2: /usr/bin/ld.gold: error: <source>.o: multiple definition of 'bool ldc.attributes... | ||||
---|---|---|---|---|
| ||||
Posted in reply to kdevel | On Sunday, 7 March 2021 at 11:34:08 UTC, kdevel wrote:
> ./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
Ah, try using `-i=-ldc` instead of `-i` alone to manually exclude the ldc.* modules from being included.
|
March 07, 2021 Re: dmd -> ldmd2: /usr/bin/ld.gold: error: <source>.o: multiple definition of 'bool ldc.attributes... | ||||
---|---|---|---|---|
| ||||
Posted in reply to z | On Sunday, 7 March 2021 at 11:50:45 UTC, z wrote: [...] > I think i had a similar error, can you try adding >>version(LDC) pragma(LDC_no_moduleinfo) > to the affected modules? At the line just after the module declaration, particularly in all package.d files and the file that contains the main function. It seems to require editing each file in the codebase, package.d does not suffice. The errors don't go away but now undefined references show up: /usr/bin/ld.gold: App.o:(.data._D3App12__ModuleInfoZ+0x128): undefined reference to `_D9tillyscop14scopserializer12__ModuleInfoZ' |
March 07, 2021 Re: dmd -> ldmd2: /usr/bin/ld.gold: error: <source>.o: multiple definition of 'bool ldc.attributes... | ||||
---|---|---|---|---|
| ||||
Posted in reply to kinke | On Sunday, 7 March 2021 at 12:47:45 UTC, kinke wrote:
[...]
>> ./dmd -i -of=pointless.o -g -c pointless/package.d
>>
>> "dmd" is a symlink to /opt/ldc2/bin/ldmd2
>
> Ah, try using `-i=-ldc` instead of `-i` alone to manually exclude the ldc.* modules from being included.
Solved the issue. Many thanks!
|
Copyright © 1999-2021 by the D Language Foundation